Class YamlImplementationCommentable

java.lang.Object
org.simpleyaml.configuration.implementation.api.YamlImplementationCommentable
All Implemented Interfaces:
Commentable, YamlImplementation
Direct Known Subclasses:
SnakeYamlImplementation

public abstract class YamlImplementationCommentable extends Object implements YamlImplementation, Commentable
A YAML implementation capable of processing comments.
  • Field Details

    • yamlCommentMapper

      protected YamlCommentMapper yamlCommentMapper
      A comment mapper to add comments to sections or values
    • options

      protected YamlConfigurationOptions options
      Configuration options for loading and dumping Yaml.
  • Constructor Details

    • YamlImplementationCommentable

      public YamlImplementationCommentable()
  • Method Details

    • setComment

      public void setComment(String path, String comment, CommentType type)
      Description copied from interface: Commentable
      Set a comment to the section or value selected by path. Comment will be indented automatically. Multi-line comments can be provided using \n character.
      Specified by:
      setComment in interface Commentable
      Parameters:
      path - path of desired section or key
      comment - the comment to add, # symbol is not needed
      type - either above (BLOCK) or SIDE
    • getComment

      public String getComment(String path, CommentType type)
      Description copied from interface: Commentable
      Retrieve the comment of the section or value selected by path.
      Specified by:
      getComment in interface Commentable
      Parameters:
      path - path of desired section or key
      type - either above (BLOCK) or SIDE
      Returns:
      the comment of the section or value selected by path, or null if that path does not have any comment of this type
    • getCommentMapper

      public YamlCommentMapper getCommentMapper()
      Get the comment mapper to get or set comments.
      Returns:
      the comment mapper or null if parsing comments is not enabled
    • configure

      public void configure(YamlConfigurationOptions options)
      Description copied from interface: YamlImplementation
      Apply the configuration options to this implementation.
      Specified by:
      configure in interface YamlImplementation
      Parameters:
      options - yaml options