java.lang.Object
java.util.prefs.Preferences
java.util.prefs.AbstractPreferences
is.codion.common.model.preferences.FilePreferences
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<String> Provides a way to override the default (OS dependent) directory used to store the user preferences file.static final PropertyValue<Boolean> Specifies whether JSON preference files are pretty-printed, causes significant size increase.Fields inherited from class java.util.prefs.AbstractPreferences
lock, newNodeFields inherited from class java.util.prefs.Preferences
MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_LENGTH -
Method Summary
Modifier and TypeMethodDescriptionprotected String[]protected AbstractPreferencesstatic PreferencesfilePreferences(String filename) protected voidflushSpi()protected String[]keysSpi()voidprotected voidprotected voidprotected voidprotected voidsyncSpi()Methods inherited from class java.util.prefs.AbstractPreferences
absolutePath, addNodeChangeListener, addPreferenceChangeListener, cachedChildren, childrenNames, clear, exportNode, exportSubtree, flush, get, getBoolean, getByteArray, getChild, getDouble, getFloat, getInt, getLong, isRemoved, isUserNode, keys, name, node, nodeExists, parent, putBoolean, putByteArray, putDouble, putFloat, putInt, putLong, remove, removeNode, removeNodeChangeListener, removePreferenceChangeListener, sync, toStringMethods inherited from class java.util.prefs.Preferences
importPreferences, systemNodeForPackage, systemRoot, userNodeForPackage, userRoot
-
Field Details
-
PREFERENCES_LOCATION
Provides a way to override the default (OS dependent) directory used to store the user preferences file.Note that changing this value after a file based preferences instance has been created has no effect on subsequent instances.
- Value type: String
- Default value: null
- See Also:
-
PRETTY_PRINT
Specifies whether JSON preference files are pretty-printed, causes significant size increase.- Value type: Boolean
- Default value: false
-
-
Method Details
-
put
- Overrides:
putin classAbstractPreferences
-
filePreferences
- Parameters:
filename- the preferences filename- Returns:
- a file based Preferences instance based on the given filename
-
putSpi
- Specified by:
putSpiin classAbstractPreferences
-
getSpi
- Specified by:
getSpiin classAbstractPreferences
-
removeSpi
- Specified by:
removeSpiin classAbstractPreferences
-
keysSpi
- Specified by:
keysSpiin classAbstractPreferences- Throws:
BackingStoreException
-
flushSpi
- Specified by:
flushSpiin classAbstractPreferences- Throws:
BackingStoreException
-
syncSpi
- Specified by:
syncSpiin classAbstractPreferences- Throws:
BackingStoreException
-
childrenNamesSpi
- Specified by:
childrenNamesSpiin classAbstractPreferences
-
childSpi
- Specified by:
childSpiin classAbstractPreferences
-
removeNodeSpi
- Specified by:
removeNodeSpiin classAbstractPreferences- Throws:
BackingStoreException
-