Class SimpleYamlImplementation

All Implemented Interfaces:
org.simpleyaml.configuration.comments.Commentable, YamlImplementation

public class SimpleYamlImplementation extends SnakeYamlImplementation
Default YAML implementation using snakeyaml high-level API and a custom comment parser / dumper.
  • Constructor Details

    • SimpleYamlImplementation

      public SimpleYamlImplementation()
    • SimpleYamlImplementation

      public SimpleYamlImplementation(org.yaml.snakeyaml.LoaderOptions loaderOptions, org.yaml.snakeyaml.DumperOptions dumperOptions)
    • SimpleYamlImplementation

      public SimpleYamlImplementation(SnakeYamlRepresenter yamlRepresenter)
    • SimpleYamlImplementation

      public SimpleYamlImplementation(SnakeYamlConstructor yamlConstructor, SnakeYamlRepresenter yamlRepresenter)
    • SimpleYamlImplementation

      public SimpleYamlImplementation(SnakeYamlConstructor yamlConstructor, SnakeYamlRepresenter yamlRepresenter, org.yaml.snakeyaml.resolver.Resolver resolver)
  • Method Details

    • setComment

      public void setComment(String path, String comment, org.simpleyaml.configuration.comments.CommentType type)
      Specified by:
      setComment in interface org.simpleyaml.configuration.comments.Commentable
      Overrides:
      setComment in class SnakeYamlImplementation
    • load

      public void load(org.simpleyaml.utils.SupplierIO.Reader readerSupplier, org.simpleyaml.configuration.ConfigurationSection section) throws IOException, org.simpleyaml.exceptions.InvalidConfigurationException
      Description copied from interface: YamlImplementation
      Load Yaml to a configuration section.
      Parameters:
      readerSupplier - a function providing a reader of Yaml contents to load
      section - the configuration to fill with the contents
      Throws:
      IOException - if cannot read contents.
      org.simpleyaml.exceptions.InvalidConfigurationException - if contents is not a valid Yaml configuration
    • load

      public void load(Reader reader, org.simpleyaml.configuration.ConfigurationSection section) throws IOException, org.simpleyaml.exceptions.InvalidConfigurationException
      Description copied from interface: YamlImplementation
      Load Yaml to a configuration section.
      Specified by:
      load in interface YamlImplementation
      Overrides:
      load in class SnakeYamlImplementation
      Parameters:
      reader - a reader of Yaml contents to load
      section - the configuration to fill with the contents
      Throws:
      IOException - if cannot read contents.
      org.simpleyaml.exceptions.InvalidConfigurationException - if contents is not a valid Yaml configuration
    • dump

      public void dump(Writer writer, org.simpleyaml.configuration.ConfigurationSection section) throws IOException
      Description copied from interface: YamlImplementation
      Dump section values to Yaml.
      Specified by:
      dump in interface YamlImplementation
      Overrides:
      dump in class SnakeYamlImplementation
      Parameters:
      writer - writer to dump values
      section - section with values to dump
      Throws:
      IOException
    • parseComments

      public YamlCommentMapper parseComments(Reader reader) throws org.simpleyaml.exceptions.InvalidConfigurationException
      Parse comments from a reader.
      Parameters:
      reader - Reader of a Configuration to parse.
      Returns:
      a comment mapper with comments parsed
      Throws:
      org.simpleyaml.exceptions.InvalidConfigurationException - if it hasn't been possible to read the contents
    • configure

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