public class PreferenceManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLOSE |
static java.lang.String |
COMMENT |
static java.lang.String |
EQUALS |
static java.lang.String |
INDENT |
static java.lang.String |
NAME |
static java.lang.String |
OPEN |
static java.lang.String |
PREF |
static java.lang.String |
PREFERENCES |
static java.lang.String |
QUEST |
static java.lang.String |
QUOTE |
static java.lang.String |
SLASH |
static java.lang.String |
SPACE |
static java.lang.String |
VALUE |
static java.lang.String |
XML |
Constructor and Description |
---|
PreferenceManager() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getPreference(java.lang.String name)
Retrieve the value of a preference.
|
static void |
loadPreferences()
Load the preferences from the file currently associated with the preference
manager.
|
static void |
savePreferences()
Save the preferences to the file currently associated with the preference
manager in XML format.
|
static void |
setFilename(java.lang.String filename)
Sets the file associated with the preference manager
|
static void |
setPreference(java.lang.String name,
java.lang.String value)
Add a preference (a name/value pair) to the current set of preferences.
|
static void |
setPreferenceNoClobber(java.lang.String name,
java.lang.String value)
If no preference of the given name exists in the set of preferences already,
then create it and set its value; otherwise leave the existing
preference alone.
|
public static final java.lang.String PREFERENCES
public static final java.lang.String PREF
public static final java.lang.String NAME
public static final java.lang.String VALUE
public static final java.lang.String OPEN
public static final java.lang.String CLOSE
public static final java.lang.String SLASH
public static final java.lang.String INDENT
public static final java.lang.String SPACE
public static final java.lang.String EQUALS
public static final java.lang.String QUOTE
public static final java.lang.String QUEST
public static final java.lang.String XML
public static final java.lang.String COMMENT
public static void setFilename(java.lang.String filename)
filename
- the name of the file from which the PreferenceManager will
hereafter attempt to read preferences from and write preferences topublic static void loadPreferences()
public static void savePreferences()
public static void setPreference(java.lang.String name, java.lang.String value)
name
- The name of the preference which is being set.value
- The value of the preference.public static void setPreferenceNoClobber(java.lang.String name, java.lang.String value)
name
- The name of the preference which is being set.value
- The value of the preference.public static java.lang.String getPreference(java.lang.String name)
name
- The name of a preference already in the preference set.