Class FilePreferences

java.lang.Object
java.util.prefs.Preferences
java.util.prefs.AbstractPreferences
is.codion.common.model.preferences.FilePreferences

public final class FilePreferences extends AbstractPreferences

A file-based preferences implementation without length restrictions.

Supports hierarchical preferences through nested JSON structure.

Clearing the preferences instance and flushing deletes the underlying file.

A key and a child node can not share a name, both being stored in the same JSON object. Putting a value for a key naming a child node throws IllegalStateException, as does putting a value into a child node named after a key, while AbstractPreferences.get(String, String) and AbstractPreferences.remove(String) ignore child nodes.

Note that, unlike the AbstractPreferences contract, PreferenceChangeListeners are not notified of put(String, String) calls.

See Also: