public class SnakeYamlImplementation extends YamlImplementationCommentable
YamlConfigurationOptions.useComments()
is enabled.Modifier and Type | Field and Description |
---|---|
protected org.yaml.snakeyaml.DumperOptions |
dumperOptions |
protected org.yaml.snakeyaml.LoaderOptions |
loaderOptions |
protected org.yaml.snakeyaml.resolver.Resolver |
resolver |
protected org.yaml.snakeyaml.Yaml |
yaml |
protected SnakeYamlConstructor |
yamlConstructor |
protected SnakeYamlRepresenter |
yamlRepresenter |
options, yamlCommentMapper
Constructor and Description |
---|
SnakeYamlImplementation() |
SnakeYamlImplementation(org.yaml.snakeyaml.LoaderOptions loaderOptions,
org.yaml.snakeyaml.DumperOptions dumperOptions) |
SnakeYamlImplementation(SnakeYamlConstructor yamlConstructor,
SnakeYamlRepresenter yamlRepresenter) |
SnakeYamlImplementation(SnakeYamlConstructor yamlConstructor,
SnakeYamlRepresenter yamlRepresenter,
org.yaml.snakeyaml.resolver.Resolver resolver) |
SnakeYamlImplementation(SnakeYamlRepresenter yamlRepresenter) |
Modifier and Type | Method and Description |
---|---|
void |
configure(YamlConfigurationOptions options)
Apply the configuration options to this implementation.
|
void |
dump(Writer writer,
ConfigurationSection section)
Dump section values to Yaml.
|
protected void |
dumpYaml(Writer writer,
ConfigurationSection section) |
SnakeYamlConstructor |
getConstructor() |
org.yaml.snakeyaml.DumperOptions |
getDumperOptions() |
org.yaml.snakeyaml.LoaderOptions |
getLoaderOptions() |
protected String |
getName(org.yaml.snakeyaml.nodes.Node node,
boolean key) |
SnakeYamlRepresenter |
getRepresenter() |
org.yaml.snakeyaml.resolver.Resolver |
getResolver() |
org.yaml.snakeyaml.Yaml |
getYaml() |
protected boolean |
hasContent(Writer writer,
ConfigurationSection section) |
void |
load(Reader reader,
ConfigurationSection section)
Load Yaml to a configuration section.
|
protected static org.yaml.snakeyaml.nodes.Node |
resolveAnchor(org.yaml.snakeyaml.nodes.Node node) |
protected org.yaml.snakeyaml.nodes.MappingNode |
sectionToMapping(ConfigurationSection section,
KeyTree.Node node,
SnakeYamlCommentMapper yamlCommentMapper) |
void |
setComment(String path,
String comment,
CommentType type)
Set a comment to the section or value selected by path.
|
protected void |
setCommentsMapping(org.yaml.snakeyaml.nodes.MappingNode mapping,
KeyTree.Node node,
SnakeYamlCommentMapper yamlCommentMapper) |
protected void |
setCommentsSequence(org.yaml.snakeyaml.nodes.SequenceNode sequence,
KeyTree.Node node,
SnakeYamlCommentMapper yamlCommentMapper) |
protected void |
trackMapping(org.yaml.snakeyaml.nodes.MappingNode node,
ConfigurationSection section,
KeyTree.Node parent,
SnakeYamlCommentMapper yamlCommentMapper) |
protected void |
trackSequence(org.yaml.snakeyaml.nodes.SequenceNode node,
KeyTree.Node parent,
SnakeYamlCommentMapper yamlCommentMapper) |
getComment, getCommentMapper
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
dump, load, load
getComment, setComment
protected final SnakeYamlConstructor yamlConstructor
protected final SnakeYamlRepresenter yamlRepresenter
protected final org.yaml.snakeyaml.DumperOptions dumperOptions
protected final org.yaml.snakeyaml.LoaderOptions loaderOptions
protected final org.yaml.snakeyaml.resolver.Resolver resolver
protected final org.yaml.snakeyaml.Yaml yaml
public SnakeYamlImplementation()
public SnakeYamlImplementation(org.yaml.snakeyaml.LoaderOptions loaderOptions, org.yaml.snakeyaml.DumperOptions dumperOptions)
public SnakeYamlImplementation(SnakeYamlRepresenter yamlRepresenter)
public SnakeYamlImplementation(SnakeYamlConstructor yamlConstructor, SnakeYamlRepresenter yamlRepresenter)
public SnakeYamlImplementation(SnakeYamlConstructor yamlConstructor, SnakeYamlRepresenter yamlRepresenter, org.yaml.snakeyaml.resolver.Resolver resolver)
public org.yaml.snakeyaml.Yaml getYaml()
public SnakeYamlConstructor getConstructor()
public SnakeYamlRepresenter getRepresenter()
public org.yaml.snakeyaml.DumperOptions getDumperOptions()
public org.yaml.snakeyaml.LoaderOptions getLoaderOptions()
public org.yaml.snakeyaml.resolver.Resolver getResolver()
public void load(Reader reader, ConfigurationSection section) throws IOException, InvalidConfigurationException
YamlImplementation
reader
- a reader of Yaml contents to loadsection
- the configuration to fill with the contentsIOException
- if cannot read contents.InvalidConfigurationException
- if contents is not a valid Yaml configurationpublic void dump(Writer writer, ConfigurationSection section) throws IOException
YamlImplementation
writer
- writer to dump valuessection
- section with values to dumpIOException
protected void dumpYaml(Writer writer, ConfigurationSection section) throws IOException
IOException
protected boolean hasContent(Writer writer, ConfigurationSection section) throws IOException
IOException
public void configure(YamlConfigurationOptions options)
YamlImplementation
configure
in interface YamlImplementation
configure
in class YamlImplementationCommentable
options
- yaml optionspublic void setComment(String path, String comment, CommentType type)
Commentable
setComment
in interface Commentable
setComment
in class YamlImplementationCommentable
path
- path of desired section or keycomment
- the comment to add, # symbol is not neededtype
- either above (BLOCK) or SIDEprotected void trackMapping(org.yaml.snakeyaml.nodes.MappingNode node, ConfigurationSection section, KeyTree.Node parent, SnakeYamlCommentMapper yamlCommentMapper)
protected void trackSequence(org.yaml.snakeyaml.nodes.SequenceNode node, KeyTree.Node parent, SnakeYamlCommentMapper yamlCommentMapper)
protected org.yaml.snakeyaml.nodes.MappingNode sectionToMapping(ConfigurationSection section, KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper)
protected void setCommentsSequence(org.yaml.snakeyaml.nodes.SequenceNode sequence, KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper)
protected void setCommentsMapping(org.yaml.snakeyaml.nodes.MappingNode mapping, KeyTree.Node node, SnakeYamlCommentMapper yamlCommentMapper)
protected String getName(org.yaml.snakeyaml.nodes.Node node, boolean key)
protected static org.yaml.snakeyaml.nodes.Node resolveAnchor(org.yaml.snakeyaml.nodes.Node node)
Copyright © 2023. All rights reserved.