Persistence API provides an easy-to-use way to store application properties:

  • its first role consists in saving application frame size and location; this way, the frame is restored over sessions.
  • its second role is to provide you with a way to save and restore any String-based properties.

Do not worry about where, how and when doing save/restore operations; it's all done by the Persistence API.


Usage sample

Saving a property is as simple as calling:

EZEnvironment.setApplicationProperty("a_key", "a_value");


Restoring a property is as simple as calling:

String myValue = EZEnvironment.getApplicationProperty("a_key");


Store location

Preferences API stores properties on a per-user basis, i.e. each user has his/her own storage location. It is located using Java User Preferences API within a node named with the application name; e.g. if your application is named "MyApplication", then application's properties are stored within java.util.prefs.Preferences.userRoot().node("MyApplication").