Interface UnmodifiableCommentedConfig
-
- All Superinterfaces:
UnmodifiableConfig
- All Known Subinterfaces:
CommentedConfig,CommentedFileConfig
- All Known Implementing Classes:
AbstractCommentedConfig,CommentedConfigWrapper,ConvertedCommentedConfig,ConvertedCommentedFileConfig,FakeCommentedConfig,FakeUnmodifiableCommentedConfig
public interface UnmodifiableCommentedConfig extends UnmodifiableConfig
An unmodifiable config that supports comments.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classUnmodifiableCommentedConfig.CommentNodestatic interfaceUnmodifiableCommentedConfig.EntryAn unmodifiable commented config entry.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>commentMap()Returns a Map view of the config's comments.default booleancontainsComment(java.lang.String path)Checks if the config contains a comment at some path.booleancontainsComment(java.util.List<java.lang.String> path)Checks if the config contains a comment at some path.java.util.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 java.lang.StringgetComment(java.lang.String path)Gets a comment from the config.java.lang.StringgetComment(java.util.List<java.lang.String> path)Gets a comment from the config.default java.util.Map<java.lang.String,UnmodifiableCommentedConfig.CommentNode>getComments()Returns a Map containing a deep copy of all the comments in the config.default voidgetComments(java.util.Map<java.lang.String,UnmodifiableCommentedConfig.CommentNode> destination)Puts all the config's comments to the specified map.default java.util.Optional<java.lang.String>getOptionalComment(java.lang.String path)Gets an optional comment from the config.default java.util.Optional<java.lang.String>getOptionalComment(java.util.List<java.lang.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 Detail
-
getComment
default java.lang.String getComment(java.lang.String path)
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
java.lang.String getComment(java.util.List<java.lang.String> path)
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
default java.util.Optional<java.lang.String> getOptionalComment(java.lang.String path)
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
default java.util.Optional<java.lang.String> getOptionalComment(java.util.List<java.lang.String> path)
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
default boolean containsComment(java.lang.String path)
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
boolean containsComment(java.util.List<java.lang.String> path)
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
java.util.Map<java.lang.String,java.lang.String> 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
default java.util.Map<java.lang.String,UnmodifiableCommentedConfig.CommentNode> 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
default void getComments(java.util.Map<java.lang.String,UnmodifiableCommentedConfig.CommentNode> destination)
Puts all the config's comments to the specified map.- Parameters:
destination- the map where to put the comments.
-
entrySet
java.util.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
static UnmodifiableCommentedConfig fake(UnmodifiableConfig config)
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
-
-