java.lang.Object
is.codion.common.model.preferences.UserPreferences
A utility class for working with user preferences
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Deletes the preferences file with the given name.static Preferences
static void
flush()
Flushes the preferences to disk, including all file based preferences initialized viafile(String)
.static String
static void
Removes the preference associated with the given keystatic void
-
Method Details
-
get
- Parameters:
key
- the key identifying the preference- Returns:
- the user preference associated with the given key
-
get
- Parameters:
key
- the key identifying the preferencedefaultValue
- the default value if no preference is available- Returns:
- the user preference associated with the given key
- Throws:
NullPointerException
- in casedefaultValue
is null
-
set
- Parameters:
key
- the key to use to identify the preferencevalue
- the preference value to associate with the given key
-
remove
Removes the preference associated with the given key- Parameters:
key
- the key to use to identify the preference to remove
-
flush
Flushes the preferences to disk, including all file based preferences initialized viafile(String)
.- Throws:
BackingStoreException
- in case of a backing store failure
-
file
- Parameters:
filename
- the preferences filename- Returns:
- a file based Preferences instance using the given filename
-
delete
Deletes the preferences file with the given name.- Parameters:
filename
- the name of the preferences file to delete- Throws:
IOException
- in case of an exceptionIllegalArgumentException
- in case the given preferences file does not exist
-