Class YamlFileWrapper
java.lang.Object
org.simpleyaml.configuration.ConfigurationWrapper<YamlFile>
org.simpleyaml.configuration.file.YamlFileWrapper
An alternative API to set values along with comments for a path.
yamlFile.path("test.hello")
.set("Hello")
.comment("Block comment")
.commentSide("Side comment");
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.simpleyaml.configuration.ConfigurationWrapper
org.simpleyaml.configuration.ConfigurationWrapper.ApplyToPath, org.simpleyaml.configuration.ConfigurationWrapper.SetToPath -
Field Summary
Fields inherited from class org.simpleyaml.configuration.ConfigurationWrapper
configuration, parent, path -
Constructor Summary
ConstructorsModifierConstructorDescriptionYamlFileWrapper(YamlFile configuration, String path) protectedYamlFileWrapper(YamlFile configuration, String path, YamlFileWrapper parent) -
Method Summary
Modifier and TypeMethodDescriptionaddDefault(Object value) addDefault(String child, Object value) Set a blank line at the beginning of the block comment.Set a block comment above the section or value selected by path.comment(String comment, YamlCommentFormat yamlCommentFormat) Set a block comment to the section or value selected by path.comment(String comment, YamlCommentFormatter yamlCommentFormatter) Set a block comment to the section or value selected by path.commentSide(String comment) Set a side comment above the section or value selected by path.commentSide(String comment, YamlCommentFormat yamlCommentFormat) Set a side comment to the section or value selected by path.commentSide(String comment, YamlCommentFormatter yamlCommentFormatter) Set a side comment to the section or value selected by path.createSection(String child) parent()set(Object value, QuoteStyle quoteStyle) Set the given value to this path.setChild(String child, Object value, QuoteStyle quoteStyle) Set the given value to the provided child path.Methods inherited from class org.simpleyaml.configuration.ConfigurationWrapper
apply, applyToChild, childPath, equals, getCurrentPath, hashCode, set, setToChild
-
Constructor Details
-
YamlFileWrapper
-
YamlFileWrapper
-
-
Method Details
-
comment
Set a block comment above the section or value selected by path. Comment will be indented automatically. Multi-line comments can be provided using \n character. Comment format will follow the rules ofYamlConfiguration.options()YamlConfigurationOptions.commentFormatter().- Parameters:
comment- the block comment to add, # character is not needed- Returns:
- this object, for chaining.
-
comment
Set a block comment to the section or value selected by path. Comment will be indented automatically. Multi-line comments can be provided using \n character. Comment format will follow the rules of the providedYamlCommentFormatter.- Parameters:
comment- the block comment to add, # prefix is not neededyamlCommentFormatter- the comment formatter to use- Returns:
- this object, for chaining.
-
comment
Set a block comment to the section or value selected by path. Comment will be indented automatically. Multi-line comments can be provided using \n character. Comment format will follow the rules of the providedYamlCommentFormat.- Parameters:
comment- the block comment to add, # prefix is not neededyamlCommentFormat- the comment format to use- Returns:
- this object, for chaining.
-
commentSide
Set a side comment above the section or value selected by path. Comment will be indented automatically. Multi-line comments can be provided using \n character. Comment format will follow the rules ofYamlConfiguration.options()YamlConfigurationOptions.commentFormatter().- Parameters:
comment- the side comment to add, # symbol is not needed- Returns:
- this object, for chaining.
-
commentSide
Set a side comment to the section or value selected by path. Comment will be indented automatically. Multi-line comments can be provided using \n character. Comment format will follow the rules of the providedYamlCommentFormatter.- Parameters:
comment- the side comment to add, # prefix is not neededyamlCommentFormatter- the comment formatter to use- Returns:
- this object, for chaining.
-
commentSide
Set a side comment to the section or value selected by path. Comment will be indented automatically. Multi-line comments can be provided using \n character. Comment format will follow the rules of the providedYamlCommentFormat.- Parameters:
comment- the side to add, # prefix is not neededyamlCommentFormat- the comment format to use- Returns:
- this object, for chaining.
-
blankLine
Set a blank line at the beginning of the block comment. If currently there is no block comment for this path then it sets "\n" as the block comment.- Returns:
- this object, for chaining.
-
path
- Overrides:
pathin classorg.simpleyaml.configuration.ConfigurationWrapper<YamlFile>
-
set
- Overrides:
setin classorg.simpleyaml.configuration.ConfigurationWrapper<YamlFile>
-
setChild
- Overrides:
setChildin classorg.simpleyaml.configuration.ConfigurationWrapper<YamlFile>
-
set
Set the given value to this path.The value will be represented with the specified quote style in the configuration file.
Any existing entry will be replaced, regardless of what the new value is. Null value is valid and will not remove the key, this is different toset(Object). Instead, a null value will be written as a yaml empty null value.- Parameters:
value- new value to set the path to.quoteStyle- the quote style to use.- Returns:
- this object, for chaining.
-
setChild
Set the given value to the provided child path.The value will be represented with the specified quote style in the configuration file.
Any existing entry will be replaced, regardless of what the new value is. Null value is valid and will not remove the key, this is different tosetChild(String, Object). Instead, a null value will be written as a yaml empty null value.- Parameters:
child- the child path of this section path.value- new value to set the path to.quoteStyle- the quote style to use.- Returns:
- this object, for chaining.
-
addDefault
- Overrides:
addDefaultin classorg.simpleyaml.configuration.ConfigurationWrapper<YamlFile>
-
addDefault
- Overrides:
addDefaultin classorg.simpleyaml.configuration.ConfigurationWrapper<YamlFile>
-
createSection
- Overrides:
createSectionin classorg.simpleyaml.configuration.ConfigurationWrapper<YamlFile>
-
createSection
- Overrides:
createSectionin classorg.simpleyaml.configuration.ConfigurationWrapper<YamlFile>
-
parent
- Overrides:
parentin classorg.simpleyaml.configuration.ConfigurationWrapper<YamlFile>
-