Class AbstractCommentedConfig
java.lang.Object
com.electronwill.nightconfig.core.AbstractConfig
com.electronwill.nightconfig.core.AbstractCommentedConfig
- All Implemented Interfaces:
CommentedConfig,Config,UnmodifiableCommentedConfig,UnmodifiableConfig,Cloneable
An abstract CommentedConfig backed by two maps: one for the values and one for the comments.
The comments of the subconfigs are stored in these subconfigs.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.electronwill.nightconfig.core.AbstractConfig
AbstractConfig.EntryWrapperNested 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.CommentNode -
Field Summary
Fields inherited from class com.electronwill.nightconfig.core.AbstractConfig
mapCreator -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCommentedConfig(boolean concurrent) AbstractCommentedConfig(UnmodifiableCommentedConfig toCopy, boolean concurrent) Creates an AbstractCommentedConfig that is a copy of the specified config.AbstractCommentedConfig(UnmodifiableCommentedConfig toCopy, Supplier<Map<String, Object>> mapCreator) AbstractCommentedConfig(UnmodifiableConfig toCopy, boolean concurrent) Creates an AbstractCommentedConfig that is a copy of the specified config.AbstractCommentedConfig(UnmodifiableConfig toCopy, Supplier<Map<String, Object>> mapCreator) AbstractCommentedConfig(Supplier<Map<String, Object>> mapCreator) AbstractCommentedConfig(Map<String, Object> valuesMap) Creates an AbstractCommentedConfig backed by the specified map -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all values from the config.voidRemoves all the comments from the config.abstract AbstractCommentedConfigclone()Creates and return a copy of this config.Returns a Map view of the config's comments.booleancontainsComment(List<String> path) Checks if the config contains a comment at some path.Set<? extends CommentedConfig.Entry>entrySet()Returns a Set view of the config's entries.getComment(List<String> path) Gets a comment from the config.getDefaultCommentMap(boolean concurrent) removeComment(List<String> path) Removes a comment from the config.setComment(List<String> path, String comment) Sets a config comment.Methods inherited from class com.electronwill.nightconfig.core.AbstractConfig
add, contains, equals, getDefaultMapCreator, getRaw, getWildcardMapCreator, hashCode, isNull, remove, set, size, toString, valueMapMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.electronwill.nightconfig.core.CommentedConfig
checked, createSubConfig, putAllComments, putAllComments, removeComment, setComment, unmodifiableMethods inherited from interface com.electronwill.nightconfig.core.Config
add, add, addAll, putAll, remove, remove, removeAll, set, set, update, update, valueMapMethods inherited from interface com.electronwill.nightconfig.core.UnmodifiableCommentedConfig
containsComment, 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
-
AbstractCommentedConfig
public AbstractCommentedConfig(boolean concurrent) -
AbstractCommentedConfig
-
AbstractCommentedConfig
Creates an AbstractCommentedConfig backed by the specified map- Parameters:
valuesMap- the map containing the config's values
-
AbstractCommentedConfig
Creates an AbstractCommentedConfig that is a copy of the specified config.- Parameters:
toCopy- the config to copy
-
AbstractCommentedConfig
-
AbstractCommentedConfig
Creates an AbstractCommentedConfig that is a copy of the specified config.- Parameters:
toCopy- the config to copy
-
AbstractCommentedConfig
public AbstractCommentedConfig(UnmodifiableCommentedConfig toCopy, Supplier<Map<String, Object>> mapCreator)
-
-
Method Details
-
getDefaultCommentMap
-
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.
-
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
-
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.
-
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:ConfigReturns a Set view of the config's entries. Any change to the set or to the entries is reflected in the config, and vice-versa.- Specified by:
entrySetin interfaceCommentedConfig- Specified by:
entrySetin interfaceConfig- Specified by:
entrySetin interfaceUnmodifiableCommentedConfig- Specified by:
entrySetin interfaceUnmodifiableConfig- Overrides:
entrySetin classAbstractConfig- Returns:
- a Set view of the config's entries.
-
clone
Description copied from class:AbstractConfigCreates and return a copy of this config.- Specified by:
clonein classAbstractConfig- Returns:
- a new config that contains the same entries (including comments) as this config.
-
clear
public void clear()Description copied from interface:ConfigRemoves all values from the config.- Specified by:
clearin interfaceConfig- Overrides:
clearin classAbstractConfig
-
clearComments
public void clearComments()Description copied from interface:CommentedConfigRemoves all the comments from the config.- Specified by:
clearCommentsin interfaceCommentedConfig
-