Crossfire JXClient, Trunk
R20561
|
Maintains a set of key/value pairs. More...
Public Member Functions | |
boolean | getBoolean (@NotNull final SettingsEntry< Boolean > key) |
Returns the boolean associated with the specified key at a node or. More... | |
int | getInt (@NotNull final SettingsEntry< Integer > key) |
Returns the integer associated with the specified key at a node or. More... | |
long | getLong (@NotNull final SettingsEntry< Long > key) |
Returns the long associated with the specified key at a node or. More... | |
String | getString (@NotNull final SettingsEntry<?> key) |
Returns the string associated with the specified key at a node, or. More... | |
void | putBoolean (@NotNull final SettingsEntry< Boolean > key, final boolean value) |
Stores a key/value pair. More... | |
void | putInt (@NotNull final SettingsEntry< Integer > key, final int value) |
Stores a key/value pair. More... | |
void | putLong (@NotNull final SettingsEntry< Long > key, final long value) |
Stores a key/value pair. More... | |
void | putString (@NotNull final SettingsEntry<?> key, @NotNull final String value) |
Stores a key/value pair. More... | |
void | remove (@NotNull final String key) |
Removes a key. More... | |
Settings (@NotNull final File file) | |
Creates a new instance. More... | |
Private Member Functions | |
void | loadValues () |
Loads the values from the backing file. More... | |
void | loadValues (@NotNull final LineNumberReader lnr) throws IOException |
Loads the values. More... | |
void | saveValues () throws IOException |
Saves the values to the backing file. More... | |
void | setChanged () |
This function is called whenever the contents of values has changed. More... | |
Static Private Member Functions | |
static void | saveNode (@NotNull final BufferedWriter writer, @NotNull final Map< String, Entry > node) throws IOException |
Saves one node. More... | |
Private Attributes | |
final File | file |
The file for loading/saving values. More... | |
boolean | noSave = true |
Flag to inhibit saving. More... | |
final Map< String, Entry > | values = new TreeMap<>() |
The stored values. More... | |
Maintains a set of key/value pairs.
The values are stored in a flat file.
Definition at line 43 of file Settings.java.
com.realtime.crossfire.jxclient.settings.Settings.Settings | ( | @NotNull final File | file | ) |
Creates a new instance.
file | the file for loading/saving values |
Definition at line 66 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.file, and com.realtime.crossfire.jxclient.settings.Settings.loadValues().
boolean com.realtime.crossfire.jxclient.settings.Settings.getBoolean | ( | @NotNull final SettingsEntry< Boolean > | key | ) |
Returns the boolean associated with the specified key at a node or.
if there is no association for this key.
key | the key to get the value for |
Definition at line 90 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.getString().
Referenced by com.realtime.crossfire.jxclient.main.JXClient.JXClient(), and com.realtime.crossfire.jxclient.settings.options.OptionManager.loadOptions().
int com.realtime.crossfire.jxclient.settings.Settings.getInt | ( | @NotNull final SettingsEntry< Integer > | key | ) |
Returns the integer associated with the specified key at a node or.
if there is no association for this key.
key | the key to get the value for |
Definition at line 105 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.getString(), and com.realtime.crossfire.jxclient.util.NumberParser.parseInt().
long com.realtime.crossfire.jxclient.settings.Settings.getLong | ( | @NotNull final SettingsEntry< Long > | key | ) |
Returns the long associated with the specified key at a node or.
if there is no association for this key.
key | the key to get the value for |
Definition at line 115 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.getString(), and com.realtime.crossfire.jxclient.util.NumberParser.parseLong().
Referenced by com.realtime.crossfire.jxclient.window.JXCConnection.setCharacter().
String com.realtime.crossfire.jxclient.settings.Settings.getString | ( | @NotNull final SettingsEntry<?> | key | ) |
Returns the string associated with the specified key at a node, or.
if there is no association for this key.
key | the key to get the value for |
Definition at line 79 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Entry.getValue().
Referenced by com.realtime.crossfire.jxclient.window.GuiManager.activateMetaserverGui(), com.realtime.crossfire.jxclient.settings.Settings.getBoolean(), com.realtime.crossfire.jxclient.settings.Settings.getInt(), com.realtime.crossfire.jxclient.settings.Settings.getLong(), com.realtime.crossfire.jxclient.window.GuiManager.openDialog(), and com.realtime.crossfire.jxclient.window.GuiManager.openQueryDialog().
|
private |
Loads the values from the backing file.
Definition at line 193 of file Settings.java.
Referenced by com.realtime.crossfire.jxclient.settings.Settings.Settings().
|
private |
Loads the values.
lnr | the line number reader from |
IOException | if an I/O error occurs |
Definition at line 216 of file Settings.java.
References com.realtime.crossfire.jxclient.util.Codec.decode(), and com.realtime.crossfire.jxclient.settings.Settings.putString().
void com.realtime.crossfire.jxclient.settings.Settings.putBoolean | ( | @NotNull final SettingsEntry< Boolean > | key, |
final boolean | value | ||
) |
Stores a key/value pair.
key | the key to store |
value | the value to store |
Definition at line 142 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.putString().
Referenced by com.realtime.crossfire.jxclient.settings.options.OptionManager.saveOptions().
void com.realtime.crossfire.jxclient.settings.Settings.putInt | ( | @NotNull final SettingsEntry< Integer > | key, |
final int | value | ||
) |
Stores a key/value pair.
key | the key to store |
value | the value to store |
Definition at line 151 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.putString().
void com.realtime.crossfire.jxclient.settings.Settings.putLong | ( | @NotNull final SettingsEntry< Long > | key, |
final long | value | ||
) |
Stores a key/value pair.
key | the key to store |
value | the value to store |
Definition at line 160 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.putString().
Referenced by com.realtime.crossfire.jxclient.window.JXCConnection.setCharacter().
void com.realtime.crossfire.jxclient.settings.Settings.putString | ( | @NotNull final SettingsEntry<?> | key, |
@NotNull final String | value | ||
) |
Stores a key/value pair.
key | the key to store |
value | the value to store |
Definition at line 124 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Entry.getValue(), com.realtime.crossfire.jxclient.settings.Settings.setChanged(), com.realtime.crossfire.jxclient.settings.Entry.setDocumentation(), and com.realtime.crossfire.jxclient.settings.Entry.setValue().
Referenced by com.realtime.crossfire.jxclient.settings.Settings.loadValues(), com.realtime.crossfire.jxclient.settings.Settings.putBoolean(), com.realtime.crossfire.jxclient.settings.Settings.putInt(), com.realtime.crossfire.jxclient.settings.Settings.putLong(), com.realtime.crossfire.jxclient.window.GuiManager.selectCharacter(), com.realtime.crossfire.jxclient.window.GuiManager.setAccountName(), com.realtime.crossfire.jxclient.window.JXCConnection.setHost(), and com.realtime.crossfire.jxclient.window.GuiManager.updatePlayerName().
void com.realtime.crossfire.jxclient.settings.Settings.remove | ( | @NotNull final String | key | ) |
Removes a key.
Does nothing if the key has no associated value.
key | the key to remove |
Definition at line 168 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.setChanged().
Referenced by com.realtime.crossfire.jxclient.main.JXClient.JXClient(), and com.realtime.crossfire.jxclient.window.JXCConnection.setCharacter().
|
staticprivate |
Saves one node.
writer | the Writer |
node | the node to save |
IOException | if the node cannot be saved |
Definition at line 264 of file Settings.java.
References com.realtime.crossfire.jxclient.util.Codec.encode(), com.realtime.crossfire.jxclient.settings.Entry.getDocumentation(), and com.realtime.crossfire.jxclient.settings.Entry.getValue().
Referenced by com.realtime.crossfire.jxclient.settings.Settings.saveValues().
|
private |
Saves the values to the backing file.
IOException | if the values cannot be saved |
Definition at line 243 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.saveNode().
Referenced by com.realtime.crossfire.jxclient.settings.Settings.setChanged().
|
private |
This function is called whenever the contents of values has changed.
Definition at line 178 of file Settings.java.
References com.realtime.crossfire.jxclient.settings.Settings.saveValues().
Referenced by com.realtime.crossfire.jxclient.settings.Settings.putString(), and com.realtime.crossfire.jxclient.settings.Settings.remove().
|
private |
The file for loading/saving values.
Definition at line 49 of file Settings.java.
Referenced by com.realtime.crossfire.jxclient.settings.Settings.Settings().
|
private |
Flag to inhibit saving.
Definition at line 60 of file Settings.java.
|
private |