T - the configuration type.public final class TOMLConfigSerializer<T extends me.shedaniel.autoconfig1u.ConfigData> extends Object implements me.shedaniel.autoconfig1u.serializer.ConfigSerializer<T>
ConfigSerializer for TOML that uses NightConfig.
Compared to Toml4jConfigSerializer,
this ConfigSerializer ensures that ConfigData.validatePostLoad() is always
called and any updated values are written to disk on both serialization and deserialization.
In addition, NightConfig's Spec* annotations are supported, and invalid values
are automatically reset to the defaults.
Furthermore, lower_snake_case for key names is enforced, and comments for properties, categories
and configuration files may be specified through the use of TOMLConfigSerializer.Comment.
reloadFromDisk() may be used to reload the configuration from disk if a reference to
the TOMLConfigSerializer is stored.
| Modifier and Type | Class and Description |
|---|---|
static interface |
TOMLConfigSerializer.Comment
A TOML configuration comment.
|
| Constructor and Description |
|---|
TOMLConfigSerializer(me.shedaniel.autoconfig1u.annotation.Config definition,
Class<T> configClass)
Constructs a
TOMLConfigSerializer with the specified definition and
configuration class. |
| Modifier and Type | Method and Description |
|---|---|
T |
createDefault() |
T |
deserialize() |
T |
getConfig()
Returns this
TOMLConfigSerializer's configuration. |
void |
reloadFromDisk()
Reloads this
TOMLConfigSerializer's configuration from disk. |
void |
serialize(T config) |
public TOMLConfigSerializer(me.shedaniel.autoconfig1u.annotation.Config definition,
Class<T> configClass)
TOMLConfigSerializer with the specified definition and
configuration class.definition - a definition.configClass - a configuration class.public void serialize(T config)
serialize in interface me.shedaniel.autoconfig1u.serializer.ConfigSerializer<T extends me.shedaniel.autoconfig1u.ConfigData>public T deserialize()
deserialize in interface me.shedaniel.autoconfig1u.serializer.ConfigSerializer<T extends me.shedaniel.autoconfig1u.ConfigData>public T createDefault()
createDefault in interface me.shedaniel.autoconfig1u.serializer.ConfigSerializer<T extends me.shedaniel.autoconfig1u.ConfigData>public T getConfig()
TOMLConfigSerializer's configuration.TOMLConfigSerializer's configuration.public void reloadFromDisk()
TOMLConfigSerializer's configuration from disk.