public class SessionStore
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
SessionStore.ExtSetting<R,T> |
class |
SessionStore.ListSetting<T> |
class |
SessionStore.MapSetting<T> |
class |
SessionStore.NullSetting<T> |
static interface |
SessionStore.OnChangeListener<T> |
class |
SessionStore.StoreSetting<T> |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_OVERRIDE |
static java.lang.String |
KEY_REMOVE |
static java.lang.String |
KEY_STORE |
Constructor and Description |
---|
SessionStore() |
Modifier and Type | Method and Description |
---|---|
Setting<java.io.File> |
addFileSetting(java.lang.String key,
java.lang.String def) |
Setting<java.io.File> |
addFileSetting(java.lang.String key,
java.lang.String def,
java.util.function.Supplier<java.io.File> path) |
Setting<java.io.File> |
addFileSetting(java.lang.String key,
java.lang.String def,
java.util.function.Supplier<java.io.File> path,
java.util.function.Function<java.lang.String,java.io.File> in) |
void |
addSerializable(java.lang.String key,
java.util.function.Consumer<?> read,
java.util.function.Supplier<?> write) |
Setting<java.lang.Boolean> |
addSetting(java.lang.String key,
boolean def) |
<T> Setting<T> |
addSetting(java.lang.String key,
T def) |
<T> Setting<T> |
addSetting(java.lang.String key,
T def,
java.lang.Class<T> clazz) |
<T> Setting<T> |
addSetting(java.lang.String key,
T def,
Serializer<T> serializer) |
java.io.File |
getMMJ2Path() |
org.json.JSONObject |
load(boolean intoSettings)
Load the data from the storage file, merging the loaded data with the
keys already loaded in memory.
|
org.json.JSONObject |
load(boolean intoSettings,
java.util.List<ProofAsstException> errors,
java.lang.String... settingsToLoad)
Load the data from the storage file, merging the loaded data with the
keys already loaded in memory.
|
org.json.JSONObject |
load(boolean intoSettings,
java.lang.String... settingsToLoad)
Load the data from the storage file, merging the loaded data with the
keys already loaded in memory.
|
void |
save()
Save the data in memory to the file, overwriting the file completely.
|
void |
setFile(java.io.File file) |
static Setting<java.lang.Integer> |
setIntBound(Setting<java.lang.Integer> setting,
int min,
int max) |
static Setting<java.lang.Integer> |
setIntBound(Setting<java.lang.Integer> setting,
java.util.function.IntSupplier min,
java.util.function.IntSupplier max) |
void |
setMMJ2Path(java.util.function.Supplier<java.io.File> path) |
public static final java.lang.String KEY_STORE
public static final java.lang.String KEY_OVERRIDE
public static final java.lang.String KEY_REMOVE
public void setMMJ2Path(java.util.function.Supplier<java.io.File> path)
public java.io.File getMMJ2Path()
public void setFile(java.io.File file)
public org.json.JSONObject load(boolean intoSettings) throws java.io.IOException
intoSettings
- True if keys present in both the file and settings
should take their values from the file, false to take
conflicts from settings.java.io.IOException
- If there is an error during the readpublic org.json.JSONObject load(boolean intoSettings, java.lang.String... settingsToLoad) throws java.io.IOException
intoSettings
- True if keys present in both the file and settings
should take their values from the file, false to take
conflicts from settings.settingsToLoad
- A list of settings to load, or null to load alljava.io.IOException
- If there is an error during the readpublic org.json.JSONObject load(boolean intoSettings, java.util.List<ProofAsstException> errors, java.lang.String... settingsToLoad) throws java.io.IOException
intoSettings
- True if keys present in both the file and settings
should take their values from the file, false to take
conflicts from settings.errors
- The list of errors that occurred, or null to print them on
the spotsettingsToLoad
- A list of settings to load, or null to load alljava.io.IOException
- If there is an error during the readpublic void addSerializable(java.lang.String key, java.util.function.Consumer<?> read, java.util.function.Supplier<?> write)
public void save() throws java.io.IOException
java.io.IOException
- If there is an I/O problempublic <T> Setting<T> addSetting(java.lang.String key, T def)
public <T> Setting<T> addSetting(java.lang.String key, T def, java.lang.Class<T> clazz)
public <T> Setting<T> addSetting(java.lang.String key, T def, Serializer<T> serializer)
public Setting<java.io.File> addFileSetting(java.lang.String key, java.lang.String def)
public Setting<java.io.File> addFileSetting(java.lang.String key, java.lang.String def, java.util.function.Supplier<java.io.File> path)
public Setting<java.io.File> addFileSetting(java.lang.String key, java.lang.String def, java.util.function.Supplier<java.io.File> path, java.util.function.Function<java.lang.String,java.io.File> in)
public Setting<java.lang.Boolean> addSetting(java.lang.String key, boolean def)
public static Setting<java.lang.Integer> setIntBound(Setting<java.lang.Integer> setting, int min, int max)