- java.lang.Object
-
- xyz.tozymc.configuration.memory.MemoryConfigSection
-
- xyz.tozymc.configuration.file.FileConfigSection
-
- All Implemented Interfaces:
DataStorage,TcConfigSection
- Direct Known Subclasses:
FileConfig
public class FileConfigSection extends MemoryConfigSection
Type ofTcConfigSectionthat is store and handle with file.- Since:
- 1.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFileConfigSection()protectedFileConfigSection(@NotNull TcConfigSection parent, @NotNull String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull TcConfigSectioncreateChild(@NotNull String path)Creates and returns the child section with specified path.@NotNull TcConfigSectioncreateChild(@NotNull String path, Map<String,?> values)Creates the child section by specified path with given values and returns it.@UnmodifiableView @NotNull Set<String>getKeys(boolean deep)Gets the set of key that contains in this storage.@Nullable ObjectgetOrDefault(@NotNull String path, @Nullable Object def)Gets the value with given path, returns the default value if requested value is null.@NotNull FileConfiggetRoot()Gets the root config that contains this section.@NotNull Map<String,?>getValues()Gets the copy map of values.protected FileConfigSectionnewSection(TcConfigSection parent, String name)@Nullable Objectset(@NotNull String path, @Nullable Object value)Sets the value to which the path is specified.@Nullable ObjectsetIfAbsent(@NotNull String path, @Nullable Object value)Sets the value to which the path is specified, the action is canceled when the path isn't in this storage.-
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, getBoolean, getDouble, getDoubleList, getInt, getIntegerList, getKeys, getList, getList, getLong, getMapList, getString, getStringList, isBoolean, isDouble, isInt, isList, isLong, isString, merge, remove, replace
-
-
-
-
Method Detail
-
newSection
protected FileConfigSection newSection(TcConfigSection parent, String name)
-
getOrDefault
@Nullable public @Nullable Object getOrDefault(@NotNull @NotNull String path, @Nullable @Nullable Object def)
Description copied from interface:DataStorageGets the value with given path, returns the default value if requested value is null.- Specified by:
getOrDefaultin interfaceDataStorage- Overrides:
getOrDefaultin classMemoryConfigSection- Parameters:
path- Path to value.def- The default value.- Returns:
- The requested object.
-
set
@Nullable public @Nullable Object set(@NotNull @NotNull String path, @Nullable @Nullable Object value)
Description copied from interface:DataStorageSets the value to which the path is specified.If
valueis null, the path will be removed.- Specified by:
setin interfaceDataStorage- Overrides:
setin classMemoryConfigSection- Parameters:
path- The path where the value will be set.value- The value to set.- Returns:
- The previous value.
-
setIfAbsent
@Nullable public @Nullable Object setIfAbsent(@NotNull @NotNull String path, @Nullable @Nullable Object value)
Description copied from interface:DataStorageSets the value to which the path is specified, the action is canceled when the path isn't in this storage.- Specified by:
setIfAbsentin interfaceDataStorage- Overrides:
setIfAbsentin classMemoryConfigSection- Parameters:
path- The path where the value will be set.value- The value to set.- Returns:
- The previous value.
-
getKeys
@NotNull public @UnmodifiableView @NotNull Set<String> getKeys(boolean deep)
Description copied from interface:DataStorageGets the set of key that contains in this storage.If
deepistrue, this method will take the keys until the key isn't the key of the storage. Otherwise, this method only takes the 1st layer of this storage.- Specified by:
getKeysin interfaceDataStorage- Overrides:
getKeysin classMemoryConfigSection- Parameters:
deep- Whether to take the keys of the child storage.- Returns:
- Set of keys contained within this storage.
-
getValues
@NotNull public @NotNull Map<String,?> getValues()
Description copied from interface:DataStorageGets the copy map of values.Mapwill be representingTcConfigSection.- Specified by:
getValuesin interfaceDataStorage- Overrides:
getValuesin classMemoryConfigSection- Returns:
- Copy map of values.
-
createChild
@NotNull public @NotNull TcConfigSection createChild(@NotNull @NotNull String path) throws TcConfigException
Description copied from interface:TcConfigSectionCreates and returns the child section with specified path.- Specified by:
createChildin interfaceTcConfigSection- Overrides:
createChildin classMemoryConfigSection- Parameters:
path- The path where the child section will be created.- Returns:
- The created child section.
- Throws:
TcConfigException- Thrown when path is existed.
-
createChild
@NotNull public @NotNull TcConfigSection createChild(@NotNull @NotNull String path, Map<String,?> values) throws TcConfigException
Description copied from interface:TcConfigSectionCreates the child section by specified path with given values and returns it.- Specified by:
createChildin interfaceTcConfigSection- Overrides:
createChildin classMemoryConfigSection- Parameters:
path- The path where the child section will be created.values- The values to set.- Returns:
- The created child section.
- Throws:
TcConfigException- Thrown when path is existed.
-
getRoot
@NotNull public @NotNull FileConfig getRoot()
Description copied from interface:TcConfigSectionGets the root config that contains this section.- Specified by:
getRootin interfaceTcConfigSection- Overrides:
getRootin classMemoryConfigSection- Returns:
- The root config.
-
-