Class YamlConfigurationLoader.Builder
- java.lang.Object
-
- org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder<YamlConfigurationLoader.Builder,YamlConfigurationLoader>
-
- org.spongepowered.configurate.yaml.YamlConfigurationLoader.Builder
-
- Enclosing class:
- YamlConfigurationLoader
public static final class YamlConfigurationLoader.Builder extends AbstractConfigurationLoader.Builder<YamlConfigurationLoader.Builder,YamlConfigurationLoader>
Builds aYamlConfigurationLoader.This builder supports the following options:
- <prefix>.yaml.node-style
- Equivalent to
nodeStyle(NodeStyle) - <prefix>.yaml.comments-enabled
- Equivalent to
commentsEnabled(boolean) - <prefix>.yaml.line-length
- Equivalent to
lineLength(int)
- Since:
- 4.0.0
-
-
Field Summary
-
Fields inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder
DEFAULT_OPTIONS_SOURCE, defaultOptions, headerMode, sink, source
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description YamlConfigurationLoaderbuild()booleancommentsEnabled()Get whether comment handling is enabled.YamlConfigurationLoader.BuildercommentsEnabled(boolean enableComments)Set whether comment handling is enabled on this loader.intindent()Gets the level of indentation to be used by the resultant loader.YamlConfigurationLoader.Builderindent(int indent)Sets the level of indentation the resultant loader should use.intlineLength()Get the maximum length of a configuration line.YamlConfigurationLoader.BuilderlineLength(int lineLength)Set the maximum length of a configuration line.@Nullable NodeStylenodeStyle()Gets the node style to be used by the resultant loader.YamlConfigurationLoader.BuildernodeStyle(@Nullable NodeStyle style)Sets the node style the built loader should use.protected voidpopulate(LoaderOptionSource options)-
Methods inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder
buildAndLoadString, buildAndSaveString, defaultOptions, defaultOptions, defaultOptions, file, from, headerMode, headerMode, path, sink, sink, source, source, url
-
-
-
-
Method Detail
-
populate
protected void populate(LoaderOptionSource options)
- Overrides:
populatein classAbstractConfigurationLoader.Builder<YamlConfigurationLoader.Builder,YamlConfigurationLoader>
-
indent
public YamlConfigurationLoader.Builder indent(int indent)
Sets the level of indentation the resultant loader should use.- Parameters:
indent- the indent level- Returns:
- this builder (for chaining)
- Since:
- 4.0.0
-
indent
public int indent()
Gets the level of indentation to be used by the resultant loader.- Returns:
- the indent level
- Since:
- 4.0.0
-
nodeStyle
public YamlConfigurationLoader.Builder nodeStyle(@Nullable NodeStyle style)
Sets the node style the built loader should use.- Flow
- the compact, json-like representation.
Example:{value: [list, of, elements], another: value} - Block
- expanded, traditional YAML
Example:value: - list - of - elements another: value
A
nullvalue will tell the loader to pick a value automatically based on the contents of each non-scalar node.- Parameters:
style- the node style to use- Returns:
- this builder (for chaining)
- Since:
- 4.0.0
-
nodeStyle
public @Nullable NodeStyle nodeStyle()
Gets the node style to be used by the resultant loader.- Returns:
- the node style
- Since:
- 4.0.0
-
commentsEnabled
public YamlConfigurationLoader.Builder commentsEnabled(boolean enableComments)
Set whether comment handling is enabled on this loader.When comment handling is enabled, comments will be read from files and written back to files where possible.
The default value is
true- Parameters:
enableComments- whether comment handling should be enabled- Returns:
- this builder (for chaining)
- Since:
- 4.2.0
-
commentsEnabled
public boolean commentsEnabled()
Get whether comment handling is enabled.- Returns:
- whether comment handling is enabled
- Since:
- 4.2.0
- See Also:
for details on comment handling
-
lineLength
public YamlConfigurationLoader.Builder lineLength(int lineLength)
Set the maximum length of a configuration line.The default value is
150- Parameters:
lineLength- the maximum length of a configuration line- Returns:
- this builder (for chaining)
- Since:
- 4.2.0
-
lineLength
public int lineLength()
Get the maximum length of a configuration line.- Returns:
- the maximum length of a configuration line
- Since:
- 4.2.0
- See Also:
for details on the line length
-
build
public YamlConfigurationLoader build()
- Specified by:
buildin classAbstractConfigurationLoader.Builder<YamlConfigurationLoader.Builder,YamlConfigurationLoader>
-
-