Class YamlFileWrapper
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
ConfigurationWrapper.ApplyToPath, 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) Sets the default value of this path.addDefault(String child, Object value) Sets the default value of the provided child path.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.Creates an emptyConfigurationSectionat this path.createSection(String child) Creates an emptyConfigurationSectionat the provided child path.parent()Returns to the parent.Get a wrapper builder for the given child path.Set the given value to this path.set(Object value, QuoteStyle quoteStyle) Set the given value to this path.Set the given value to the provided child 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
Description copied from class:ConfigurationWrapperGet a wrapper builder for the given child path.- Overrides:
pathin classConfigurationWrapper<YamlFile>- Parameters:
path- child path of this section path, not null.- Returns:
- the child path wrapper
-
set
Description copied from class:ConfigurationWrapperSet the given value to this path.If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.
- Overrides:
setin classConfigurationWrapper<YamlFile>- Parameters:
value- new value to set the path to.- Returns:
- this object, for chaining.
-
setChild
Description copied from class:ConfigurationWrapperSet the given value to the provided child path.If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.
- Overrides:
setChildin classConfigurationWrapper<YamlFile>- Parameters:
child- the child path of this section path.value- new value to set the child path to.- Returns:
- this object, for chaining.
-
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
Description copied from class:ConfigurationWrapperSets the default value of this path.If no source
Configurationwas provided as a default collection, then a newMemoryConfigurationwill be created to hold the new default value.If value is null, the value will be removed from the default Configuration source.
If the value as returned by
ConfigurationSection.getDefaultSection()is null, then this will create a new section at the path, replacing anything that may have existed there previously.- Overrides:
addDefaultin classConfigurationWrapper<YamlFile>- Parameters:
value- value to set the default to.- Returns:
- this object, for chaining.
-
addDefault
Description copied from class:ConfigurationWrapperSets the default value of the provided child path.If no source
Configurationwas provided as a default collection, then a newMemoryConfigurationwill be created to hold the new default value.If value is null, the value will be removed from the default Configuration source.
If the value as returned by
ConfigurationSection.getDefaultSection()is null, then this will create a new section at the path, replacing anything that may have existed there previously.- Overrides:
addDefaultin classConfigurationWrapper<YamlFile>- Parameters:
child- the child path of this section path.value- value to set the default to.- Returns:
- this object, for chaining.
-
createSection
Description copied from class:ConfigurationWrapperCreates an emptyConfigurationSectionat this path.Any value that was previously set at this path will be overwritten. If the previous value was itself a
ConfigurationSection, it will be orphaned.- Overrides:
createSectionin classConfigurationWrapper<YamlFile>- Returns:
- this object, for chaining.
-
createSection
Description copied from class:ConfigurationWrapperCreates an emptyConfigurationSectionat the provided child path.Any value that was previously set at this will be overwritten. If the previous value was itself a
ConfigurationSection, it will be orphaned.- Overrides:
createSectionin classConfigurationWrapper<YamlFile>- Parameters:
child- the child path of this section path.- Returns:
- this object, for chaining.
-
parent
Description copied from class:ConfigurationWrapperReturns to the parent.- Overrides:
parentin classConfigurationWrapper<YamlFile>- Returns:
- the parent path wrapper, or null if this path does not have a parent.
-