Class SnakeYamlImplementation

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

public class SnakeYamlImplementation extends YamlImplementationCommentable
YAML implementation using snakeyaml low-level API and snakeyaml comment processing available if YamlConfigurationOptions.useComments() is enabled.
  • Field Details

    • yamlConstructor

      protected final SnakeYamlConstructor yamlConstructor
    • yamlRepresenter

      protected final SnakeYamlRepresenter yamlRepresenter
    • dumperOptions

      protected final org.yaml.snakeyaml.DumperOptions dumperOptions
    • loaderOptions

      protected final org.yaml.snakeyaml.LoaderOptions loaderOptions
    • resolver

      protected final org.yaml.snakeyaml.resolver.Resolver resolver
    • yaml

      protected final org.yaml.snakeyaml.Yaml yaml
  • Constructor Details

    • SnakeYamlImplementation

      public SnakeYamlImplementation()
    • SnakeYamlImplementation

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

      public SnakeYamlImplementation(SnakeYamlRepresenter yamlRepresenter)
    • SnakeYamlImplementation

      public SnakeYamlImplementation(SnakeYamlConstructor yamlConstructor, SnakeYamlRepresenter yamlRepresenter)
    • SnakeYamlImplementation

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

    • getYaml

      public org.yaml.snakeyaml.Yaml getYaml()
    • getConstructor

      public SnakeYamlConstructor getConstructor()
    • getRepresenter

      public SnakeYamlRepresenter getRepresenter()
    • getDumperOptions

      public org.yaml.snakeyaml.DumperOptions getDumperOptions()
    • getLoaderOptions

      public org.yaml.snakeyaml.LoaderOptions getLoaderOptions()
    • getResolver

      public org.yaml.snakeyaml.resolver.Resolver getResolver()
    • 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.
      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.
      Parameters:
      writer - writer to dump values
      section - section with values to dump
      Throws:
      IOException
    • dumpYaml

      protected void dumpYaml(Writer writer, org.simpleyaml.configuration.ConfigurationSection section) throws IOException
      Throws:
      IOException
    • hasContent

      protected boolean hasContent(Writer writer, org.simpleyaml.configuration.ConfigurationSection section) throws IOException
      Throws:
      IOException
    • 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 YamlImplementationCommentable
      Parameters:
      options - yaml options
    • 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 YamlImplementationCommentable
    • trackMapping

      protected void trackMapping(org.yaml.snakeyaml.nodes.MappingNode node, org.simpleyaml.configuration.ConfigurationSection section, org.simpleyaml.configuration.comments.KeyTree.Node parent, SnakeYamlCommentMapper yamlCommentMapper)
    • trackSequence

      protected void trackSequence(org.yaml.snakeyaml.nodes.SequenceNode node, org.simpleyaml.configuration.comments.KeyTree.Node parent, SnakeYamlCommentMapper yamlCommentMapper)
    • sectionToMapping

      protected org.yaml.snakeyaml.nodes.MappingNode sectionToMapping(org.simpleyaml.configuration.ConfigurationSection section, org.simpleyaml.configuration.comments.KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper)
    • setCommentsSequence

      protected void setCommentsSequence(org.yaml.snakeyaml.nodes.SequenceNode sequence, org.simpleyaml.configuration.comments.KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper)
    • setCommentsMapping

      protected void setCommentsMapping(org.yaml.snakeyaml.nodes.MappingNode mapping, org.simpleyaml.configuration.comments.KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper)
    • getName

      protected String getName(org.yaml.snakeyaml.nodes.Node node, boolean key)
    • resolveAnchor

      protected static org.yaml.snakeyaml.nodes.Node resolveAnchor(org.yaml.snakeyaml.nodes.Node node)