Class ConvertedConfig
java.lang.Object
com.electronwill.nightconfig.core.utils.UnmodifiableConfigWrapper<C>
com.electronwill.nightconfig.core.utils.ConfigWrapper<C>
com.electronwill.nightconfig.core.conversion.ConvertedConfig
- All Implemented Interfaces:
Config,UnmodifiableConfig
A Config's wrapper that converts the values that are read from and put into the config
-
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
ConstructorsConstructorDescriptionConvertedConfig(Config config, ConversionTable readTable, ConversionTable writeTable, Predicate<Class<?>> supportPredicate) Creates a new ConvertedConfig that uses two conversion tables.ConvertedConfig(Config config, Function<Object, Object> readConversion, Function<Object, Object> writeConversion, Predicate<Class<?>> supportPredicate) Creates a new ConvertedConfig that uses two custom conversion functions. -
Method Summary
Modifier and TypeMethodDescriptionConfigFormat<?>Returns the config's format.Set<? extends Config.Entry>entrySet()Returns a Set view of the config's entries.<T> TGets a value from the config.<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, 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, checked, clear, createSubConfig, putAll, remove, remove, removeAll, set, unmodifiable, update, updateMethods inherited from interface com.electronwill.nightconfig.core.UnmodifiableConfig
apply, apply, 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, getShort, getShort, getShortOrElse, getShortOrElse, isEmpty, isNull, isNull, size
-
Constructor Details
-
ConvertedConfig
public ConvertedConfig(Config config, ConversionTable readTable, ConversionTable writeTable, Predicate<Class<?>> supportPredicate) Creates a new ConvertedConfig that uses two conversion tables.- Parameters:
config- the config to wrapreadTable- the ConversionTable used for parse operations (like getValue)writeTable- the ConversionTable used for write operations (like setValue)supportPredicate- a Predicate that checks if a given class is supported by the ConvertedConfig
-
ConvertedConfig
public ConvertedConfig(Config config, Function<Object, Object> readConversion, Function<Object, Object> writeConversion, Predicate<Class<?>> supportPredicate) Creates a new ConvertedConfig that uses two custom conversion functions.- Parameters:
config- the config to wrapreadConversion- the Function used for parse operations (like getValue)writeConversion- the Function used for write operations (like setValue)supportPredicate- a Predicate that checks if a given class is supported by the ConvertedConfig
-
-
Method Details
-
entrySet
Description copied from interface:UnmodifiableConfigReturns a Set view of the config's entries. If the config is unmodifiable then the returned set is unmodifiable too.- Specified by:
entrySetin interfaceConfig- Specified by:
entrySetin interfaceUnmodifiableConfig- Overrides:
entrySetin classConfigWrapper<Config>- Returns:
- a Set view of the config's entries.
-
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>
-