T - the type of ConfigurationNodepublic class ConfigFile<T extends ninja.leaping.configurate.ConfigurationNode>
extends java.lang.Object
ConfigurationLoader. Allows you to easily get and save data.| Modifier and Type | Field and Description |
|---|---|
private java.nio.file.Path |
file
The location of the configuration file on disk.
|
private ninja.leaping.configurate.loader.ConfigurationLoader<T> |
loader
The active loader for the configuration file on disk.
|
private static org.slf4j.Logger |
LOGGER
The ConfigFile logger.
|
private T |
root
The loaded
ConfigurationNode at the root level. |
| Constructor and Description |
|---|
ConfigFile(java.nio.file.Path file,
ninja.leaping.configurate.loader.ConfigurationLoader<T> loader,
T root)
Constructs a new
ConfigFile. |
| Modifier and Type | Method and Description |
|---|---|
java.nio.file.Path |
getFile()
Gets the location of the configuration file on disk.
|
java.nio.file.Path |
getFileDirectory()
Gets the location of the configuration file's parent directory on disk.
|
ninja.leaping.configurate.loader.ConfigurationLoader<T> |
getLoader()
Gets the active loader for the configuration file on disk.
|
T |
getNode()
Gets the root
ConfigurationNode. |
ninja.leaping.configurate.ConfigurationNode |
getNode(java.lang.Object... path)
Gets a
ConfigurationNode on any level. |
ninja.leaping.configurate.ConfigurationNode |
getNode(java.lang.Object path)
Gets a
ConfigurationNode on the first level. |
boolean |
reload()
Reloads the configuration from the
ConfigurationLoader. |
void |
reloadWithException()
Reloads the configuration from the
ConfigurationLoader. |
boolean |
save()
Saves the root
ConfigurationNode with the active ConfigurationLoader. |
void |
saveWithException()
Saves the root
ConfigurationNode with the active ConfigurationLoader. |
private static final org.slf4j.Logger LOGGER
@Nonnull private final java.nio.file.Path file
@Nonnull private final ninja.leaping.configurate.loader.ConfigurationLoader<T extends ninja.leaping.configurate.ConfigurationNode> loader
@Nonnull private T extends ninja.leaping.configurate.ConfigurationNode root
ConfigurationNode at the root level.public ConfigFile(@Nonnull
java.nio.file.Path file,
@Nonnull
ninja.leaping.configurate.loader.ConfigurationLoader<T> loader,
@Nonnull
T root)
ConfigFile.file - the location of the configuration file on diskloader - the active loaded for the configuration file on diskroot - the loaded ConfigurationNode at the root level@Nonnull public java.nio.file.Path getFile()
@Nonnull public java.nio.file.Path getFileDirectory()
@Nonnull public ninja.leaping.configurate.loader.ConfigurationLoader<T> getLoader()
@Nonnull public T getNode()
ConfigurationNode.public ninja.leaping.configurate.ConfigurationNode getNode(java.lang.Object path)
ConfigurationNode on the first level.path - the key for the nodeConfigurationNode on the first levelpublic ninja.leaping.configurate.ConfigurationNode getNode(java.lang.Object... path)
ConfigurationNode on any level.path - the key path for the nodeConfigurationNode on any levelpublic boolean save()
ConfigurationNode with the active ConfigurationLoader.
Does not give exceptions upon failure.
public void saveWithException()
throws java.io.IOException
ConfigurationNode with the active ConfigurationLoader.java.io.IOException - if ConfigurationLoader.save(ConfigurationNode) throws an exceptionpublic boolean reload()
ConfigurationLoader.
Does not give exceptions upon failure.
public void reloadWithException()
throws java.io.IOException
ConfigurationLoader.java.io.IOException - if ConfigurationLoader.load() throws an exception