Package snap.util
Class Prefs
java.lang.Object
snap.util.Prefs
A platform implementation of preferences.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addStringForKey
(String aString, String aKey) Adds a string for given key.void
clear()
Clears all the preferences.void
clearStringsForKey
(String aKey) Clears strings for key.void
flush()
Updates any persistant store associated with these preferences.boolean
getBoolean
(String aKey, boolean aDefault) Returns an boolean value for given key.Returns a child prefs for given name.static Prefs
Returns the default prefs.double
Returns a float value for given key.static Prefs
getFake()
Returns a prefs instance that doesn't do anything.int
Returns an int value for given key.abstract String[]
getKeys()
Returns the currently set prefs keys.long
Returns a long value for given key.getName()
Returns the name.static Prefs
getPrefsForName
(String aName) Returns the preferences for given node name.Returns a value for given string.Returns a value for given string and default.getStringsForKey
(String aKey) Returns a list of strings for key.Returns a value for given string.abstract Object
Returns a value for given string and default.void
Removes a value for given key.void
removeStringForKey
(String aString, String aKey) Removes a string for given key.static void
setDefaultPrefs
(Prefs thePrefs) Sets the default preferences instance.void
setStringsForKey
(List<String> theStrings, String aKey) Sets a list of strings for key.abstract void
Sets a value for given string.
-
Constructor Details
-
Prefs
public Prefs()Constructor.
-
-
Method Details
-
getName
Returns the name. -
getValue
Returns a value for given string. -
getValue
Returns a value for given string and default. -
setValue
Sets a value for given string. -
remove
Removes a value for given key. -
getString
Returns a value for given string. -
getString
Returns a value for given string and default. -
getInt
Returns an int value for given key. -
getLong
Returns a long value for given key. -
getDouble
Returns a float value for given key. -
getBoolean
Returns an boolean value for given key. -
getKeys
Returns the currently set prefs keys. -
getStringsForKey
Returns a list of strings for key. -
setStringsForKey
Sets a list of strings for key. -
addStringForKey
Adds a string for given key. -
removeStringForKey
Removes a string for given key. -
clearStringsForKey
Clears strings for key. -
getChild
Returns a child prefs for given name. -
flush
public void flush()Updates any persistant store associated with these preferences. -
clear
public void clear()Clears all the preferences. -
getDefaultPrefs
Returns the default prefs. -
setDefaultPrefs
Sets the default preferences instance. -
getPrefsForName
Returns the preferences for given node name. -
getFake
Returns a prefs instance that doesn't do anything.
-