public class Preferences
extends java.lang.Object
Constructor and Description |
---|
Preferences(IOUtils.SavingConfig config)
Creates a new Preferences Object using the file in the
IOUtils.SavingConfig . |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
get(java.lang.String name,
java.lang.String def)
Fetches the value of the given preference's name.
|
IOUtils.SavingConfig |
getPreferenceConfig()
Returns the used
IOUtils.SavingConfig . |
boolean |
has(java.lang.String name)
Checks whether a preference entry exists.
|
void |
remove(java.lang.String name)
Removes a preference entry.
|
void |
setPreferenceConfig(IOUtils.SavingConfig config)
Sets the
IOUtils.SavingConfig . |
void |
write(java.lang.String name,
java.lang.String value)
Creates a new preference entry with a
name and a value or
overrides the value if a preference entry with the same
name already exists. |
public Preferences(IOUtils.SavingConfig config)
IOUtils.SavingConfig
.config
- The IOUtils.SavingConfig
to use.public void setPreferenceConfig(IOUtils.SavingConfig config)
IOUtils.SavingConfig
.config
- The IOUtils.SavingConfig
to set.public IOUtils.SavingConfig getPreferenceConfig()
IOUtils.SavingConfig
.IOUtils.SavingConfig
.public java.lang.String get(java.lang.String name, java.lang.String def)
name
- The name of the preference to return the value of.def
- The value that is returned when the preference with
name
could not be found.name
or def
when
name
could not be found.public void write(java.lang.String name, java.lang.String value)
name
and a value
or
overrides the value
if a preference entry with the same
name
already exists.name
- The name of the preference to write.value
- The corresponding value. Old value will be overridden if
name
already exists.public boolean has(java.lang.String name)
name
- The name of the preference to check for.true
when it exists, else false
.public void remove(java.lang.String name)
name
- The name of the preference to remove.