Class ConvertedFileConfig
java.lang.Object
com.electronwill.nightconfig.core.utils.UnmodifiableConfigWrapper<C>
com.electronwill.nightconfig.core.utils.ConfigWrapper<C>
com.electronwill.nightconfig.core.conversion.ConvertedFileConfig
- All Implemented Interfaces:
Config,FileConfig,UnmodifiableConfig,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.electronwill.nightconfig.core.Config
Config.EntryNested classes/interfaces inherited from interface com.electronwill.nightconfig.core.UnmodifiableConfig
UnmodifiableConfig.Entry -
Field Summary
Fields inherited from class com.electronwill.nightconfig.core.utils.UnmodifiableConfigWrapper
config -
Constructor Summary
ConstructorsConstructorDescriptionConvertedFileConfig(FileConfig config, ConversionTable readTable, ConversionTable writeTable, Predicate<Class<?>> supportPredicate) ConvertedFileConfig(FileConfig config, Function<Object, Object> readConversion, Function<Object, Object> writeConversion, Predicate<Class<?>> supportPredicate) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this FileConfig, releases its associated resources (if any), and ensure that the ongoing saving operations complete.ConfigFormat<?>Returns the config's format.getFile()<T> TGets a value from the config.voidload()(Re)loads this config from the file.voidsave()Saves this config as soon as possible.<T> TSets a config value.toString()valueMap()Returns a Map view of the config's values.Methods inherited from class com.electronwill.nightconfig.core.utils.ConfigWrapper
add, clear, createSubConfig, entrySet, removeMethods inherited from class com.electronwill.nightconfig.core.utils.UnmodifiableConfigWrapper
contains, equals, hashCode, isEmpty, sizeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.electronwill.nightconfig.core.Config
add, add, addAll, clear, createSubConfig, entrySet, putAll, remove, remove, removeAll, set, set, unmodifiable, update, update, valueMapMethods inherited from interface com.electronwill.nightconfig.core.file.FileConfig
checkedMethods inherited from interface com.electronwill.nightconfig.core.UnmodifiableConfig
apply, apply, configFormat, contains, contains, get, get, getByte, getByte, getByteOrElse, getByteOrElse, getChar, getChar, getCharOrElse, getCharOrElse, getEnum, getEnum, getEnum, getEnum, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getInt, getInt, getIntOrElse, getIntOrElse, getIntOrElse, getIntOrElse, getLong, getLong, getLongOrElse, getLongOrElse, getLongOrElse, getLongOrElse, getOptional, getOptional, getOptionalEnum, getOptionalEnum, getOptionalEnum, getOptionalEnum, getOptionalInt, getOptionalInt, getOptionalLong, getOptionalLong, getOrElse, getOrElse, getOrElse, getOrElse, getRaw, getRaw, getShort, getShort, getShortOrElse, getShortOrElse, isEmpty, isNull, isNull, size
-
Constructor Details
-
ConvertedFileConfig
public ConvertedFileConfig(FileConfig config, ConversionTable readTable, ConversionTable writeTable, Predicate<Class<?>> supportPredicate) -
ConvertedFileConfig
-
-
Method Details
-
getFile
- Specified by:
getFilein interfaceFileConfig- Returns:
- the config's file, as a classic File object
-
getNioPath
- Specified by:
getNioPathin interfaceFileConfig- Returns:
- the config's file, as a NIO Path object
-
save
public void save()Description copied from interface:FileConfigSaves this config as soon as possible. This method may return quickly and perform the IO operations in background, or it may block until the operations are done.- Specified by:
savein interfaceFileConfig
-
load
public void load()Description copied from interface:FileConfig(Re)loads this config from the file. This method blocks until the read operation completes.- Specified by:
loadin interfaceFileConfig
-
close
public void close()Description copied from interface:FileConfigCloses this FileConfig, releases its associated resources (if any), and ensure that the ongoing saving operations complete.A closed FileConfig can still be used via the Config's methods, but
FileConfig.save()andFileConfig.load()will throw an IllegalStateException. Closing an aleady closed FileConfig has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceFileConfig
-
set
Description copied from interface:ConfigSets a config value.- Specified by:
setin interfaceConfig- Overrides:
setin classConfigWrapper<C extends Config>- Type Parameters:
T- the type of the old value- Parameters:
path- the value's path, each element of the list is a different part of the path.value- the value to set- Returns:
- the old value if any, or
null
-
valueMap
Description copied from interface:UnmodifiableConfigReturns a Map view of the config's values. If the config is unmodifiable then the returned map is unmodifiable too.- Specified by:
valueMapin interfaceConfig- Specified by:
valueMapin interfaceUnmodifiableConfig- Overrides:
valueMapin classUnmodifiableConfigWrapper<C extends Config>- Returns:
- a Map view of the config's values.
-
getRaw
Description copied from interface:UnmodifiableConfigGets a value from the config. Doesn't convertNullObject.NULL_OBJECTtonull.- Specified by:
getRawin interfaceUnmodifiableConfig- Overrides:
getRawin classUnmodifiableConfigWrapper<C extends Config>- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.- Returns:
- the value at the given path, or
nullif there is no such value.
-
configFormat
Description copied from interface:UnmodifiableConfigReturns the config's format.- Specified by:
configFormatin interfaceUnmodifiableConfig- Overrides:
configFormatin classUnmodifiableConfigWrapper<C extends Config>- Returns:
- the config's format
-
toString
- Overrides:
toStringin classConfigWrapper<C extends Config>
-