Class ConvertedCommentedFileConfig
java.lang.Object
com.electronwill.nightconfig.core.utils.UnmodifiableConfigWrapper<C>
com.electronwill.nightconfig.core.utils.ConfigWrapper<C>
com.electronwill.nightconfig.core.conversion.ConvertedCommentedFileConfig
- All Implemented Interfaces:
CommentedConfig,Config,CommentedFileConfig,FileConfig,UnmodifiableCommentedConfig,UnmodifiableConfig,AutoCloseable
public final class ConvertedCommentedFileConfig
extends ConfigWrapper<C>
implements CommentedFileConfig
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.electronwill.nightconfig.core.CommentedConfig
CommentedConfig.EntryNested classes/interfaces inherited from interface com.electronwill.nightconfig.core.Config
Config.EntryNested classes/interfaces inherited from interface com.electronwill.nightconfig.core.UnmodifiableCommentedConfig
UnmodifiableCommentedConfig.CommentNodeNested 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
ConstructorsConstructorDescriptionConvertedCommentedFileConfig(CommentedFileConfig config, ConversionTable readTable, ConversionTable writeTable, Predicate<Class<?>> supportPredicate) ConvertedCommentedFileConfig(CommentedFileConfig config, Function<Object, Object> readConversion, Function<Object, Object> writeConversion, Predicate<Class<?>> supportPredicate) -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all the comments from the config.voidclose()Closes this FileConfig, releases its associated resources (if any), and ensure that the ongoing saving operations complete.Returns a Map view of the config's comments.ConfigFormat<?>Returns the config's format.booleancontainsComment(List<String> path) Checks if the config contains a comment at some path.Creates a new sub config of this config, as created when a subconfig's creation is implied byConfig.set(List, Object)orConfig.add(List, Object).Set<? extends CommentedConfig.Entry>entrySet()Returns a Set view of the config's entries.getComment(List<String> path) Gets a comment from the config.Returns a Map containing a deep copy of all the comments in the config.getFile()<T> TGets a value from the config.voidload()(Re)loads this config from the file.voidputAllComments(UnmodifiableCommentedConfig commentedConfig) Puts the comments in the given config to this config.voidPuts the comments in the given map to this config.removeComment(List<String> path) Removes a comment from the config.voidsave()Saves this config as soon as possible.<T> TSets a config value.setComment(List<String> path, String comment) Sets a config comment.toString()valueMap()Returns a Map view of the config's values.Methods inherited from class com.electronwill.nightconfig.core.utils.ConfigWrapper
add, clear, 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.CommentedConfig
clearComments, commentMap, createSubConfig, entrySet, putAllComments, putAllComments, removeComment, removeComment, setComment, setComment, unmodifiableMethods inherited from interface com.electronwill.nightconfig.core.file.CommentedFileConfig
checkedMethods inherited from interface com.electronwill.nightconfig.core.Config
add, add, addAll, clear, entrySet, putAll, remove, remove, removeAll, set, set, update, update, valueMapMethods inherited from interface com.electronwill.nightconfig.core.UnmodifiableCommentedConfig
containsComment, containsComment, getComment, getComment, getComments, getComments, getOptionalComment, getOptionalCommentMethods 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
-
ConvertedCommentedFileConfig
public ConvertedCommentedFileConfig(CommentedFileConfig config, ConversionTable readTable, ConversionTable writeTable, Predicate<Class<?>> supportPredicate) -
ConvertedCommentedFileConfig
-
-
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
-
getComment
Description copied from interface:UnmodifiableCommentedConfigGets a comment from the config.- Specified by:
getCommentin interfaceUnmodifiableCommentedConfig- Parameters:
path- the comment's path, each element of the list is a different part of the path.- Returns:
- the comment at the given path, or
nullif there is none.
-
containsComment
Description copied from interface:UnmodifiableCommentedConfigChecks if the config contains a comment at some path.- Specified by:
containsCommentin interfaceUnmodifiableCommentedConfig- Parameters:
path- the path to check, each element of the list is a different part of the path.- Returns:
trueif the path is associated with a comment,falseif it's not.
-
setComment
Description copied from interface:CommentedConfigSets a config comment.- Specified by:
setCommentin interfaceCommentedConfig- Parameters:
path- the comment's path, each element of the list is a different part of the path.comment- the comment to set- Returns:
- the old comment if any, or
null
-
removeComment
Description copied from interface:CommentedConfigRemoves a comment from the config.- Specified by:
removeCommentin interfaceCommentedConfig- Parameters:
path- the comment's path, each element of the list is a different part of the path.- Returns:
- the old comment if any, or
null
-
clearComments
public void clearComments()Description copied from interface:CommentedConfigRemoves all the comments from the config.- Specified by:
clearCommentsin interfaceCommentedConfig
-
getComments
Description copied from interface:UnmodifiableCommentedConfigReturns a Map containing a deep copy of all the comments in the config.- Specified by:
getCommentsin interfaceUnmodifiableCommentedConfig- Returns:
- a Map containing the comments in the config.
-
putAllComments
Description copied from interface:CommentedConfigPuts the comments in the given map to this config. Existing comments are replaced, missing comments are created.- Specified by:
putAllCommentsin interfaceCommentedConfig- Parameters:
comments- the comments to set
-
putAllComments
Description copied from interface:CommentedConfigPuts the comments in the given config to this config. Existing comments are replaced, missing comments are created.- Specified by:
putAllCommentsin interfaceCommentedConfig- Parameters:
commentedConfig- the config to copy its comments
-
commentMap
Description copied from interface:CommentedConfigReturns a Map view of the config's comments. Any change to the map is reflected in the config and vice-versa.The comment map contains only the comments of the direct elements of the configuration, not the comments of their sub-elements.
- Specified by:
commentMapin interfaceCommentedConfig- Specified by:
commentMapin interfaceUnmodifiableCommentedConfig- Returns:
- a Map view of the config's comments.
-
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 interfaceCommentedConfig- Specified by:
entrySetin interfaceConfig- Specified by:
entrySetin interfaceUnmodifiableCommentedConfig- Specified by:
entrySetin interfaceUnmodifiableConfig- Overrides:
entrySetin classConfigWrapper<C extends CommentedConfig>- Returns:
- a Set view of the config's entries.
-
createSubConfig
Description copied from interface:ConfigCreates a new sub config of this config, as created when a subconfig's creation is implied byConfig.set(List, Object)orConfig.add(List, Object).- Specified by:
createSubConfigin interfaceCommentedConfig- Specified by:
createSubConfigin interfaceConfig- Overrides:
createSubConfigin classConfigWrapper<C extends CommentedConfig>- Returns:
- a new sub config
-
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>
-