Class SnakeYamlImplementation
java.lang.Object
org.simpleyaml.configuration.implementation.api.YamlImplementationCommentable
org.simpleyaml.configuration.implementation.snakeyaml.SnakeYamlImplementation
- All Implemented Interfaces:
Commentable,YamlImplementation
- Direct Known Subclasses:
SimpleYamlImplementation
YAML implementation using snakeyaml low-level API and snakeyaml comment processing available if
YamlConfigurationOptions.useComments() is enabled.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.yaml.snakeyaml.DumperOptionsprotected final org.yaml.snakeyaml.LoaderOptionsprotected final org.yaml.snakeyaml.resolver.Resolverprotected final org.yaml.snakeyaml.Yamlprotected final SnakeYamlConstructorprotected final SnakeYamlRepresenterFields inherited from class org.simpleyaml.configuration.implementation.api.YamlImplementationCommentable
options, yamlCommentMapper -
Constructor Summary
ConstructorsConstructorDescriptionSnakeYamlImplementation(SnakeYamlConstructor yamlConstructor, SnakeYamlRepresenter yamlRepresenter) SnakeYamlImplementation(SnakeYamlConstructor yamlConstructor, SnakeYamlRepresenter yamlRepresenter, org.yaml.snakeyaml.resolver.Resolver resolver) SnakeYamlImplementation(SnakeYamlRepresenter yamlRepresenter) SnakeYamlImplementation(org.yaml.snakeyaml.LoaderOptions loaderOptions, org.yaml.snakeyaml.DumperOptions dumperOptions) -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(YamlConfigurationOptions options) Apply the configuration options to this implementation.voiddump(Writer writer, ConfigurationSection section) Dump section values to Yaml.protected voiddumpYaml(Writer writer, ConfigurationSection section) org.yaml.snakeyaml.DumperOptionsorg.yaml.snakeyaml.LoaderOptionsprotected StringgetName(org.yaml.snakeyaml.nodes.Node node, boolean key) org.yaml.snakeyaml.resolver.Resolverorg.yaml.snakeyaml.YamlgetYaml()protected booleanhasContent(Writer writer, ConfigurationSection section) voidload(Reader reader, ConfigurationSection section) Load Yaml to a configuration section.protected static org.yaml.snakeyaml.nodes.NoderesolveAnchor(org.yaml.snakeyaml.nodes.Node node) protected org.yaml.snakeyaml.nodes.MappingNodesectionToMapping(ConfigurationSection section, KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper) voidsetComment(String path, String comment, CommentType type) Set a comment to the section or value selected by path.protected voidsetCommentsMapping(org.yaml.snakeyaml.nodes.MappingNode mapping, KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper) protected voidsetCommentsSequence(org.yaml.snakeyaml.nodes.SequenceNode sequence, KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper) protected voidtrackMapping(org.yaml.snakeyaml.nodes.MappingNode node, ConfigurationSection section, KeyTree.Node parent, SnakeYamlCommentMapper yamlCommentMapper) protected voidtrackSequence(org.yaml.snakeyaml.nodes.SequenceNode node, KeyTree.Node parent, SnakeYamlCommentMapper yamlCommentMapper) Methods inherited from class org.simpleyaml.configuration.implementation.api.YamlImplementationCommentable
getComment, getCommentMapperMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.simpleyaml.configuration.comments.Commentable
getComment, setCommentMethods inherited from interface org.simpleyaml.configuration.implementation.api.YamlImplementation
dump, load, load
-
Field Details
-
yamlConstructor
-
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
-
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
-
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, ConfigurationSection section) throws IOException, InvalidConfigurationException Description copied from interface:YamlImplementationLoad Yaml to a configuration section.- Parameters:
reader- a reader of Yaml contents to loadsection- the configuration to fill with the contents- Throws:
IOException- if cannot read contents.InvalidConfigurationException- if contents is not a valid Yaml configuration
-
dump
Description copied from interface:YamlImplementationDump section values to Yaml.- Parameters:
writer- writer to dump valuessection- section with values to dump- Throws:
IOException
-
dumpYaml
- Throws:
IOException
-
hasContent
- Throws:
IOException
-
configure
Description copied from interface:YamlImplementationApply the configuration options to this implementation.- Specified by:
configurein interfaceYamlImplementation- Overrides:
configurein classYamlImplementationCommentable- Parameters:
options- yaml options
-
setComment
Description copied from interface:CommentableSet 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:
setCommentin interfaceCommentable- Overrides:
setCommentin classYamlImplementationCommentable- Parameters:
path- path of desired section or keycomment- the comment to add, # symbol is not neededtype- either above (BLOCK) or SIDE
-
trackMapping
protected void trackMapping(org.yaml.snakeyaml.nodes.MappingNode node, ConfigurationSection section, KeyTree.Node parent, SnakeYamlCommentMapper yamlCommentMapper) -
trackSequence
protected void trackSequence(org.yaml.snakeyaml.nodes.SequenceNode node, KeyTree.Node parent, SnakeYamlCommentMapper yamlCommentMapper) -
sectionToMapping
protected org.yaml.snakeyaml.nodes.MappingNode sectionToMapping(ConfigurationSection section, KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper) -
setCommentsSequence
protected void setCommentsSequence(org.yaml.snakeyaml.nodes.SequenceNode sequence, KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper) -
setCommentsMapping
protected void setCommentsMapping(org.yaml.snakeyaml.nodes.MappingNode mapping, KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper) -
getName
-
resolveAnchor
protected static org.yaml.snakeyaml.nodes.Node resolveAnchor(org.yaml.snakeyaml.nodes.Node node)
-