Class JsonPreferences

java.lang.Object
is.codion.common.model.preferences.JsonPreferences

public final class JsonPreferences extends Object
In-memory hierarchical JSON storage for preferences — the storage half of JsonPreferencesStore, without any file handling. Path-addressed ("a/b/c") get/put/remove of string values, plus child-node listing. Thread-safe.

A value is returned as it was put. One that is JSON in the form this class writes it, {"w":100,"i":0}, is stored nested, for a readable file, and may come back with its members in another order once the file has been read again; any other value is stored as the string it is, text that merely starts with a bracket included.

jsonPreferences() wraps a fresh instance as a free-floating, file-less Preferences node — useful for capturing or transferring preference state in memory (dependency panels) and for hermetic tests that must not touch the real user preferences store.

See Also: