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 a
YamlConfigurationLoader.
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
FieldsModifier and TypeFieldDescriptionstatic final net.kyori.option.Option<BlankLineStyle>The blank line style for writing YAML documents.static final net.kyori.option.Option<Boolean>Whether comments are being read and written.static final net.kyori.option.Option<Integer>The indent size (in spaces) to use for documents emitted by the created loader.static final net.kyori.option.Option<Integer>The line length before the scalar representation is split into multiple lines.static final net.kyori.option.Option<NodeStyle>The collection node style to use globally when emitting with this loader.static final net.kyori.option.OptionSchemaA schema of options available to configure the YAML loader.Fields inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder
defaultOptions, HEADER_MODE, headerMode, sink, source -
Method Summary
Modifier and TypeMethodDescription@Nullable BlankLineStyleGets the explicitly applied current blank line styling.blankLineStyle(@Nullable BlankLineStyle style) Sets the blank line style handling for all written files.build()booleanGet whether comment handling is enabled.commentsEnabled(boolean enableComments) Set whether comment handling is enabled on this loader.intindent()Gets the level of indentation to be used by the resultant loader.indent(int indent) Sets the level of indentation the resultant loader should use.intGet the maximum length of a configuration line.lineLength(int lineLength) Set the maximum length of a configuration line.@Nullable NodeStyleGets the node style to be used by the resultant loader.Sets the node style the built loader should use.protected net.kyori.option.OptionSchemaMethods inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder
buildAndLoadString, buildAndSaveString, defaultOptions, defaultOptions, defaultOptions, editOptions, file, headerMode, headerMode, optionState, optionState, optionStateBuilder, path, sink, sink, source, source, url
-
Field Details
-
SCHEMA
A schema of options available to configure the YAML loader.- Since:
- 4.2.0
-
NODE_STYLE
The collection node style to use globally when emitting with this loader.- Since:
- 4.2.0
- See Also:
-
INDENT
The indent size (in spaces) to use for documents emitted by the created loader.- Since:
- 4.2.0
- See Also:
-
COMMENTS_ENABLED
Whether comments are being read and written.- Since:
- 4.3.0
- See Also:
-
LINE_LENGTH
The line length before the scalar representation is split into multiple lines.- Since:
- 4.3.0
- See Also:
-
BLANK_LINE_STYLE
The blank line style for writing YAML documents.- Since:
- 4.3.0
- See Also:
-
-
Method Details
-
optionSchema
-
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
Gets the level of indentation to be used by the resultant loader.- Returns:
- the indent level
- Since:
- 4.0.0
-
nodeStyle
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
Gets the node style to be used by the resultant loader.- Returns:
- the node style
- Since:
- 4.0.0
-
blankLineStyle
Sets the blank line style handling for all written files.- Parameters:
style- the style to apply- Returns:
- this builder
- Since:
- 4.3.0
- See Also:
-
blankLineStyle
Gets the explicitly applied current blank line styling. This doesn't return the implicit fallback used when not setting it explicitly.- Returns:
- the blank line style
- Since:
- 4.3.0
-
commentsEnabled
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.3.0
-
commentsEnabled
Get whether comment handling is enabled.- Returns:
- whether comment handling is enabled
- Since:
- 4.3.0
- See Also:
-
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.3.0
-
lineLength
Get the maximum length of a configuration line.- Returns:
- the maximum length of a configuration line
- Since:
- 4.3.0
- See Also:
-
build
- Specified by:
buildin classAbstractConfigurationLoader.Builder<YamlConfigurationLoader.Builder,YamlConfigurationLoader>
-