public class YamlFileWrapper extends ConfigurationWrapper<YamlFile>
yamlFile.path("test.hello")
.set("Hello")
.comment("Block comment")
.commentSide("Side comment");
YamlFile.path(String)
ConfigurationWrapper.ApplyToPath, ConfigurationWrapper.SetToPath
configuration, parent, path
Modifier | Constructor and Description |
---|---|
|
YamlFileWrapper(YamlFile configuration,
String path) |
protected |
YamlFileWrapper(YamlFile configuration,
String path,
YamlFileWrapper parent) |
Modifier and Type | Method and Description |
---|---|
YamlFileWrapper |
addDefault(Object value)
Sets the default value of this path.
|
YamlFileWrapper |
addDefault(String child,
Object value)
Sets the default value of the provided child path.
|
YamlFileWrapper |
blankLine()
Set a blank line at the beginning of the block comment.
|
YamlFileWrapper |
comment(String comment)
Set a block comment above the section or value selected by path.
|
YamlFileWrapper |
comment(String comment,
YamlCommentFormat yamlCommentFormat)
Set a block comment to the section or value selected by path.
|
YamlFileWrapper |
comment(String comment,
YamlCommentFormatter yamlCommentFormatter)
Set a block comment to the section or value selected by path.
|
YamlFileWrapper |
commentSide(String comment)
Set a side comment above the section or value selected by path.
|
YamlFileWrapper |
commentSide(String comment,
YamlCommentFormat yamlCommentFormat)
Set a side comment to the section or value selected by path.
|
YamlFileWrapper |
commentSide(String comment,
YamlCommentFormatter yamlCommentFormatter)
Set a side comment to the section or value selected by path.
|
YamlFileWrapper |
createSection()
Creates an empty
ConfigurationSection at this path. |
YamlFileWrapper |
createSection(String child)
Creates an empty
ConfigurationSection at the provided child path. |
YamlFileWrapper |
parent()
Returns to the parent.
|
YamlFileWrapper |
path(String path)
Get a wrapper builder for the given child path.
|
YamlFileWrapper |
set(Object value)
Set the given value to this path.
|
YamlFileWrapper |
set(Object value,
QuoteStyle quoteStyle)
Set the given value to this path.
|
YamlFileWrapper |
setChild(String child,
Object value)
Set the given value to the provided child path.
|
YamlFileWrapper |
setChild(String child,
Object value,
QuoteStyle quoteStyle)
Set the given value to the provided child path.
|
apply, applyToChild, childPath, equals, getCurrentPath, hashCode, set, setToChild
protected YamlFileWrapper(YamlFile configuration, String path, YamlFileWrapper parent)
public YamlFileWrapper comment(String comment)
YamlConfiguration.options()
YamlConfigurationOptions.commentFormatter()
.comment
- the block comment to add, # character is not neededpublic YamlFileWrapper comment(String comment, YamlCommentFormatter yamlCommentFormatter)
YamlCommentFormatter
.comment
- the block comment to add, # prefix is not neededyamlCommentFormatter
- the comment formatter to usepublic YamlFileWrapper comment(String comment, YamlCommentFormat yamlCommentFormat)
YamlCommentFormat
.comment
- the block comment to add, # prefix is not neededyamlCommentFormat
- the comment format to usepublic YamlFileWrapper commentSide(String comment)
YamlConfiguration.options()
YamlConfigurationOptions.commentFormatter()
.comment
- the side comment to add, # symbol is not neededpublic YamlFileWrapper commentSide(String comment, YamlCommentFormatter yamlCommentFormatter)
YamlCommentFormatter
.comment
- the side comment to add, # prefix is not neededyamlCommentFormatter
- the comment formatter to usepublic YamlFileWrapper commentSide(String comment, YamlCommentFormat yamlCommentFormat)
YamlCommentFormat
.comment
- the side to add, # prefix is not neededyamlCommentFormat
- the comment format to usepublic YamlFileWrapper blankLine()
public YamlFileWrapper path(String path)
ConfigurationWrapper
path
in class ConfigurationWrapper<YamlFile>
path
- child path of this section path, not null.public YamlFileWrapper set(Object value)
ConfigurationWrapper
If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.
set
in class ConfigurationWrapper<YamlFile>
value
- new value to set the path to.public YamlFileWrapper setChild(String child, Object value)
ConfigurationWrapper
If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.
setChild
in class ConfigurationWrapper<YamlFile>
child
- the child path of this section path.value
- new value to set the child path to.public YamlFileWrapper set(Object value, QuoteStyle quoteStyle)
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.value
- new value to set the path to.quoteStyle
- the quote style to use.public YamlFileWrapper setChild(String child, Object value, QuoteStyle quoteStyle)
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.child
- the child path of this section path.value
- new value to set the path to.quoteStyle
- the quote style to use.public YamlFileWrapper addDefault(Object value)
ConfigurationWrapper
If no source Configuration
was provided as a default
collection, then a new MemoryConfiguration
will 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.
addDefault
in class ConfigurationWrapper<YamlFile>
value
- value to set the default to.public YamlFileWrapper addDefault(String child, Object value)
ConfigurationWrapper
If no source Configuration
was provided as a default
collection, then a new MemoryConfiguration
will 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.
addDefault
in class ConfigurationWrapper<YamlFile>
child
- the child path of this section path.value
- value to set the default to.public YamlFileWrapper createSection()
ConfigurationWrapper
ConfigurationSection
at 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.
createSection
in class ConfigurationWrapper<YamlFile>
public YamlFileWrapper createSection(String child)
ConfigurationWrapper
ConfigurationSection
at 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.
createSection
in class ConfigurationWrapper<YamlFile>
child
- the child path of this section path.public YamlFileWrapper parent()
ConfigurationWrapper
parent
in class ConfigurationWrapper<YamlFile>
Copyright © 2023. All rights reserved.