- java.lang.Object
-
- xyz.tozymc.configuration.memory.MemoryConfigSection
-
- xyz.tozymc.configuration.file.FileConfigSection
-
- xyz.tozymc.configuration.file.FileConfig
-
- All Implemented Interfaces:
DataStorage,TcConfig,TcConfigSection
public abstract class FileConfig extends FileConfigSection implements TcConfig
Type ofTcConfigSectionthat is store and handle with file.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected FileConfigOptionsoptions
-
Constructor Summary
Constructors Modifier Constructor Description protectedFileConfig(@NotNull Path path)Constructs newFileConfigSectionwith configuration file.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description @NotNull FileConfigOptionsgetOptions()Gets the options of this configuration.@NotNull PathgetPath()Gets the configuration file.protected abstract Map<String,?>readToMap()Loads value to map from file.voidreload()Reads data from file and loads it to memory.protected voidreloadIfNeeded()voidsave()Writes data in memory to string and saves it to file.protected abstract StringwriteToString()Writes this config to string to save in file.-
Methods inherited from class xyz.tozymc.configuration.file.FileConfigSection
createChild, createChild, getKeys, getOrDefault, getRoot, getValues, newSection, set, setIfAbsent
-
Methods inherited from class xyz.tozymc.configuration.memory.MemoryConfigSection
get, get, getChild, getFullPath, getName, getOrDefault, getParent, hasChild, reloadSection
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface xyz.tozymc.configuration.DataStorage
compute, computeIfAbsent, computeIfPresent, contains, contains, find, find, get, get, getBoolean, getDouble, getDoubleList, getInt, getIntegerList, getKeys, getKeys, getList, getList, getLong, getMapList, getOrDefault, getOrDefault, getString, getStringList, getValues, isBoolean, isDouble, isInt, isList, isLong, isString, merge, remove, replace, set, setIfAbsent
-
Methods inherited from interface xyz.tozymc.configuration.TcConfigSection
createChild, createChild, getChild, getFullPath, getName, getRoot, hasChild
-
-
-
-
Field Detail
-
options
protected FileConfigOptions options
-
-
Constructor Detail
-
FileConfig
protected FileConfig(@NotNull @NotNull Path path)
Constructs newFileConfigSectionwith configuration file.- Parameters:
path- The configuration file
-
-
Method Detail
-
readToMap
protected abstract Map<String,?> readToMap() throws IOException
Loads value to map from file.- Returns:
- Loaded values map.
- Throws:
IOException- Thrown when error when reading file.
-
writeToString
protected abstract String writeToString()
Writes this config to string to save in file.- Returns:
- New string.
-
reload
public void reload()
Reads data from file and loads it to memory.
-
save
public void save()
Writes data in memory to string and saves it to file.
-
reloadIfNeeded
protected void reloadIfNeeded()
-
getOptions
@NotNull public @NotNull FileConfigOptions getOptions()
Description copied from interface:TcConfigGets the options of this configuration.- Specified by:
getOptionsin interfaceTcConfig- Returns:
- Options of this configuration.
-
-