public abstract class AbstractPreferences extends java.lang.Object implements IPreferences
IPreferences interface.| Constructor and Description |
|---|
AbstractPreferences() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
get(java.lang.String key,
java.lang.String def)
Get settings value for a certain key and provide a default value.
|
java.util.Map<java.lang.String,java.lang.String> |
getAllPrefix(java.lang.String prefix)
Gets all normal (string) settings that have a key starting with the prefix
|
java.util.List<java.lang.String> |
getAllPrefixCollectionKeys(java.lang.String prefix)
Gets all list settings that have a key starting with the prefix
|
abstract java.util.Map<java.lang.String,Setting<?>> |
getAllSettings()
Gets a map of all settings that are currently stored
|
boolean |
getBoolean(java.lang.String key,
boolean def)
Gets a boolean preference
|
double |
getDouble(java.lang.String key,
double def)
Gets a double preference
|
int |
getInt(java.lang.String key,
int def)
Gets an integer preference
|
java.util.List<java.lang.String> |
getList(java.lang.String key,
java.util.List<java.lang.String> def)
Get a list of values for a certain key
|
java.util.List<java.util.List<java.lang.String>> |
getListOfLists(java.lang.String key,
java.util.List<java.util.List<java.lang.String>> def)
Get an array of values (list of lists) for a certain key
|
java.util.List<java.util.Map<java.lang.String,java.lang.String>> |
getListOfMaps(java.lang.String key,
java.util.List<java.util.Map<java.lang.String,java.lang.String>> def)
Gets a list of key/value maps.
|
long |
getLong(java.lang.String key,
long def)
Gets a long preference
|
abstract <T extends Setting<?>> |
getSetting(java.lang.String key,
T def,
java.lang.Class<T> klass)
Get settings value for a certain key and provide default a value.
|
boolean |
put(java.lang.String key,
java.lang.String value)
Set a value for a certain setting.
|
boolean |
putBoolean(java.lang.String key,
boolean value)
Set a boolean value for a certain setting.
|
boolean |
putDouble(java.lang.String key,
double value)
Set a boolean value for a certain setting.
|
boolean |
putInt(java.lang.String key,
int value)
Set an integer value for a certain setting.
|
boolean |
putList(java.lang.String key,
java.util.List<java.lang.String> value)
Set a list of values for a certain key.
|
boolean |
putListOfLists(java.lang.String key,
java.util.List<java.util.List<java.lang.String>> value)
Set an array of values (list of lists) for a certain key.
|
boolean |
putListOfMaps(java.lang.String key,
java.util.List<java.util.Map<java.lang.String,java.lang.String>> value)
Set an a list of key/value maps.
|
boolean |
putLong(java.lang.String key,
long value)
Set a long value for a certain setting.
|
abstract boolean |
putSetting(java.lang.String key,
Setting<?> setting)
Set a value for a certain setting.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddKeyPreferenceChangeListener, addPreferenceChangeListener, get, getBoolean, getKeySet, getList, getListOfLists, getListOfMaps, removeKeyPreferenceChangeListener, removePreferenceChangeListenerpublic AbstractPreferences()
public java.lang.String get(java.lang.String key, java.lang.String def)
IPreferencesget in interface IPreferenceskey - the identifier for the settingdef - the default value. For each call of get() with a given key, the
default value must be the same. def may be null.def otherwisepublic boolean put(java.lang.String key, java.lang.String value)
IPreferencesput in interface IPreferenceskey - the unique identifier for the settingvalue - the value of the setting. Can be null or "" which both removes the key-value entry.true, if something has changed (i.e. value is different than before)public boolean getBoolean(java.lang.String key, boolean def)
IPreferencesgetBoolean in interface IPreferenceskey - The preference keydef - The default value to usefalse if it could not be parsed, the default value if it is unsetpublic boolean putBoolean(java.lang.String key, boolean value)
IPreferencesputBoolean in interface IPreferenceskey - the unique identifier for the settingvalue - The new valuetrue, if something has changed (i.e. value is different than before)public int getInt(java.lang.String key, int def)
IPreferencesgetInt in interface IPreferenceskey - The preference keydef - The default value to usepublic boolean putInt(java.lang.String key, int value)
IPreferencesputInt in interface IPreferenceskey - the unique identifier for the settingvalue - The new valuetrue, if something has changed (i.e. value is different than before)public long getLong(java.lang.String key, long def)
IPreferencesgetLong in interface IPreferenceskey - The preference keydef - The default value to usepublic boolean putLong(java.lang.String key, long value)
IPreferencesputLong in interface IPreferenceskey - the unique identifier for the settingvalue - The new valuetrue, if something has changed (i.e. value is different than before)public double getDouble(java.lang.String key, double def)
IPreferencesgetDouble in interface IPreferenceskey - The preference keydef - The default value to usepublic boolean putDouble(java.lang.String key, double value)
IPreferencesputDouble in interface IPreferenceskey - the unique identifier for the settingvalue - The new valuetrue, if something has changed (i.e. value is different than before)public java.util.List<java.lang.String> getList(java.lang.String key, java.util.List<java.lang.String> def)
IPreferencesgetList in interface IPreferenceskey - the identifier for the settingdef - the default value.def otherwisepublic boolean putList(java.lang.String key, java.util.List<java.lang.String> value)
IPreferencesputList in interface IPreferenceskey - the identifier for the settingvalue - The new valuetrue, if something has changed (i.e. value is different than before)public java.util.List<java.util.List<java.lang.String>> getListOfLists(java.lang.String key, java.util.List<java.util.List<java.lang.String>> def)
IPreferencesgetListOfLists in interface IPreferenceskey - the identifier for the settingdef - the default value.def otherwisepublic boolean putListOfLists(java.lang.String key, java.util.List<java.util.List<java.lang.String>> value)
IPreferencesputListOfLists in interface IPreferenceskey - the identifier for the settingvalue - the new valuetrue, if something has changed (i.e. value is different than before)public java.util.List<java.util.Map<java.lang.String,java.lang.String>> getListOfMaps(java.lang.String key, java.util.List<java.util.Map<java.lang.String,java.lang.String>> def)
IPreferencesgetListOfMaps in interface IPreferenceskey - the key to search atdef - the default value to usedef otherwisepublic boolean putListOfMaps(java.lang.String key, java.util.List<java.util.Map<java.lang.String,java.lang.String>> value)
IPreferencesputListOfMaps in interface IPreferenceskey - the key to store the list invalue - a list of key/value mapstrue if the value was changedpublic abstract java.util.Map<java.lang.String,Setting<?>> getAllSettings()
public abstract boolean putSetting(java.lang.String key, Setting<?> setting)
key - the unique identifier for the settingsetting - the value of the setting. In case it is null, the key-value entry will be removed.true, if something has changed (i.e. value is different than before)public abstract <T extends Setting<?>> T getSetting(java.lang.String key, T def, java.lang.Class<T> klass)
T - the setting typekey - the identifier for the settingdef - the default value. For each call of getSetting() with a given key, the default value must be the same.
def must not be null, but the value of def can be null.klass - the setting type (same as T)def otherwisepublic java.util.Map<java.lang.String,java.lang.String> getAllPrefix(java.lang.String prefix)
prefix - The start of the keypublic java.util.List<java.lang.String> getAllPrefixCollectionKeys(java.lang.String prefix)
prefix - The start of the key