Interface UnmodifiableCommentedConfig
- All Superinterfaces:
UnmodifiableConfig
- All Known Subinterfaces:
CommentedConfig,CommentedFileConfig
- All Known Implementing Classes:
AbstractCommentedConfig,CommentedConfigWrapper,ConvertedCommentedConfig,ConvertedCommentedFileConfig,FakeCommentedConfig,FakeUnmodifiableCommentedConfig
An unmodifiable config that supports comments.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic interfaceAn unmodifiable commented config entry. -
Method Summary
Modifier and TypeMethodDescriptionReturns a Map view of the config's comments.default booleancontainsComment(String path) Checks if the config contains a comment at some path.booleancontainsComment(List<String> path) Checks if the config contains a comment at some path.Set<? extends UnmodifiableCommentedConfig.Entry>entrySet()Returns a Set view of the config's entries.static UnmodifiableCommentedConfigfake(UnmodifiableConfig config) If the specified config is an instance of UnmodifiableCommentedConfig, returns it.default StringgetComment(String path) Gets a comment from the config.getComment(List<String> path) Gets a comment from the config.Returns a Map containing a deep copy of all the comments in the config.default voidgetComments(Map<String, UnmodifiableCommentedConfig.CommentNode> destination) Puts all the config's comments to the specified map.getOptionalComment(String path) Gets an optional comment from the config.getOptionalComment(List<String> path) Gets an optional comment from the config.Methods 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, valueMap
-
Method Details
-
getComment
Gets a comment from the config.- Parameters:
path- the comment's path, each part separated by a dot. Example "a.b.c"- Returns:
- the comment at the given path, or
nullif there is none.
-
getComment
Gets a comment from the config.- 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.
-
getOptionalComment
Gets an optional comment from the config.- Parameters:
path- the comment's path, each part separated by a dot. Example "a.b.c"- Returns:
- an Optional containing the comment at the given path, or
Optional.empty()if there is no such comment.
-
getOptionalComment
Gets an optional comment from the config.- Parameters:
path- the comment's path, each element of the list is a different part of the path.- Returns:
- an Optional containing the comment at the given path, or
Optional.empty()if there is no such comment.
-
containsComment
Checks if the config contains a comment at some path.- Parameters:
path- the path to check, each part separated by a dot. Example "a.b.c"- Returns:
trueif the path is associated with a comment,falseif it's not.
-
containsComment
Checks if the config contains a comment at some path.- 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
Returns a Map view of the config's comments. If the config is unmodifiable then the returned map is unmodifiable too.The comment map contains only the comments of the direct elements of the configuration, not the comments of their sub-elements.
- Returns:
- a Map view of the config's comments.
-
getComments
Returns a Map containing a deep copy of all the comments in the config.- Returns:
- a Map containing the comments in the config.
-
getComments
Puts all the config's comments to the specified map.- Parameters:
destination- the map where to put the comments.
-
entrySet
Set<? extends UnmodifiableCommentedConfig.Entry> 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 interfaceUnmodifiableConfig- Returns:
- a Set view of the config's entries.
-
fake
If the specified config is an instance of UnmodifiableCommentedConfig, returns it. Else, returns a "fake" UnmodifiableCommentedConfig instance with the same values (ie the valueMaps are equal) as the config. This fake UnmodifiableCommentedConfig doesn't actually store nor process comments, it just provides the methods of UnmodifiableCommentedConfig.- Parameters:
config- the config- Returns:
- an UnmodifiableCommentedConfig instance backed by the specified config
-