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.
  • Method Details

    • getComment

      default String getComment(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 null if there is none.
    • getComment

      String getComment(List<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 null if there is none.
    • getOptionalComment

      default Optional<String> getOptionalComment(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 Optional<String> getOptionalComment(List<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(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:
      true if the path is associated with a comment, false if it's not.
    • containsComment

      boolean containsComment(List<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:
      true if the path is associated with a comment, false if it's not.
    • commentMap

      Map<String,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

      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(Map<String,UnmodifiableCommentedConfig.CommentNode> destination)
      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: UnmodifiableConfig
      Returns a Set view of the config's entries. If the config is unmodifiable then the returned set is unmodifiable too.
      Specified by:
      entrySet in interface UnmodifiableConfig
      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