public static class DumperSettings.Builder extends Object
DumpSettingsBuilder class which is more
detailed, provides more options and possibilities, hides options which should not be configured.| Modifier and Type | Field and Description |
|---|---|
static Supplier<org.snakeyaml.engine.v2.serializer.AnchorGenerator> |
DEFAULT_ANCHOR_GENERATOR
Default anchor generator supplier.
|
static boolean |
DEFAULT_CANONICAL
If to dump in canonical form by default.
|
static DumperSettings.Encoding |
DEFAULT_ENCODING
Default encoding.
|
static boolean |
DEFAULT_END_MARKER
If to add document end by default.
|
static boolean |
DEFAULT_ESCAPE_UNPRINTABLE
If to escape unprintable unicode characters by default.
|
static org.snakeyaml.engine.v2.common.FlowStyle |
DEFAULT_FLOW_STYLE
Default flow style.
|
static int |
DEFAULT_INDENTATION
Default spaces per one indentation level.
|
static int |
DEFAULT_INDICATOR_INDENTATION
Default spaces to use to indent indicators.
|
static int |
DEFAULT_MAX_LINE_WIDTH
Max line width by default.
|
static int |
DEFAULT_MAX_SIMPLE_KEY_LENGTH
Max length for a key to have to be dumped in simple format.
|
static boolean |
DEFAULT_MULTILINE_FORMAT
If to use multiline format by default.
|
static org.snakeyaml.engine.v2.nodes.Tag |
DEFAULT_ROOT_TAG
Default root tag.
|
static org.snakeyaml.engine.v2.common.ScalarStyle |
DEFAULT_SCALAR_STYLE
Default scalar style.
|
static boolean |
DEFAULT_START_MARKER
If to add document start by default.
|
| Modifier and Type | Method and Description |
|---|---|
DumperSettings |
build()
Builds the settings.
|
DumperSettings.Builder |
setAnchorGenerator(Supplier<org.snakeyaml.engine.v2.serializer.AnchorGenerator> generator)
Sets custom anchor generator supplier used to supply generators when dumping.
|
DumperSettings.Builder |
setCanonicalForm(boolean canonical)
Sets if to dump in canonical form.
|
DumperSettings.Builder |
setEncoding(DumperSettings.Encoding encoding)
Sets the encoding to use.
|
DumperSettings.Builder |
setEndMarker(boolean endMarker)
Sets if to forcefully add document end marker (
... |
DumperSettings.Builder |
setEscapeUnprintable(boolean escape)
Sets if strings containing unprintable characters should have those characters escaped, or the whole string
dumped as binary data.
|
DumperSettings.Builder |
setFlowStyle(org.snakeyaml.engine.v2.common.FlowStyle flowStyle)
Sets flow style to use.
|
DumperSettings.Builder |
setIndentation(int spaces)
Sets how many spaces to use per one indent = one level in YAML indentation hierarchy.
|
DumperSettings.Builder |
setIndicatorIndentation(int spaces)
Sets how many spaces to use per one indentation level for indicators.
|
DumperSettings.Builder |
setLineBreak(String lineBreak)
Sets the line break appended at the end of each line.
|
DumperSettings.Builder |
setLineWidth(int width)
Sets the preferred line width.
|
DumperSettings.Builder |
setMaxSimpleKeyLength(int length)
Sets the maximum length a key can (in serialized form, also applies to flow sequence and map keys) have to be
printed in simple format (without the explicit key indicator
? |
DumperSettings.Builder |
setMultilineStyle(boolean multilineStyle)
Sets if to separate content of the document using newlines to make the dumped file somewhat readable; has
effect if and only if the flow style is set to
FlowStyle.FLOW. |
DumperSettings.Builder |
setRootTag(org.snakeyaml.engine.v2.nodes.Tag rootTag)
Sets (explicit) tag of the root document element (top-level element in the document).
|
DumperSettings.Builder |
setScalarResolver(org.snakeyaml.engine.v2.resolver.ScalarResolver resolver)
Sets custom scalar resolver, used to resolve tags for objects.
|
DumperSettings.Builder |
setScalarStyle(org.snakeyaml.engine.v2.common.ScalarStyle scalarStyle)
Sets scalar style to use.
|
DumperSettings.Builder |
setStartMarker(boolean startMarker)
Sets if to forcefully add document start marker (
---). |
DumperSettings.Builder |
setTagDirectives(Map<String,String> directives)
Sets the given tag (
%TAG) directives in form of a map, where key is the ! |
DumperSettings.Builder |
setUnprintableStyle(org.snakeyaml.engine.v2.common.NonPrintableStyle style)
Sets if strings containing unprintable characters should have those characters escaped, or the whole string
dumped as binary data.
|
DumperSettings.Builder |
setYamlDirective(org.snakeyaml.engine.v2.common.SpecVersion directive)
Sets the version (
%YAML) directive. |
public static final Supplier<org.snakeyaml.engine.v2.serializer.AnchorGenerator> DEFAULT_ANCHOR_GENERATOR
public static final org.snakeyaml.engine.v2.common.FlowStyle DEFAULT_FLOW_STYLE
public static final org.snakeyaml.engine.v2.common.ScalarStyle DEFAULT_SCALAR_STYLE
public static final boolean DEFAULT_START_MARKER
public static final boolean DEFAULT_END_MARKER
public static final org.snakeyaml.engine.v2.nodes.Tag DEFAULT_ROOT_TAG
public static final boolean DEFAULT_CANONICAL
public static final boolean DEFAULT_MULTILINE_FORMAT
public static final DumperSettings.Encoding DEFAULT_ENCODING
public static final int DEFAULT_INDENTATION
public static final int DEFAULT_INDICATOR_INDENTATION
public static final int DEFAULT_MAX_LINE_WIDTH
public static final int DEFAULT_MAX_SIMPLE_KEY_LENGTH
public static final boolean DEFAULT_ESCAPE_UNPRINTABLE
public DumperSettings.Builder setAnchorGenerator(@NotNull Supplier<org.snakeyaml.engine.v2.serializer.AnchorGenerator> generator)
Supplier ensures that a brand new, yet unused generator, is used on every file dump.
For additional information please refer to documentation of the parent method listed below.
Default: DEFAULT_ANCHOR_GENERATOR
Parent method: DumpSettingsBuilder.setAnchorGenerator(AnchorGenerator)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): anchors
and aliases
generator - the new anchor generator supplierDumpSettingsBuilder.setAnchorGenerator(AnchorGenerator)public DumperSettings.Builder setFlowStyle(@NotNull org.snakeyaml.engine.v2.common.FlowStyle flowStyle)
For additional information please refer to documentation of the parent method listed below.
Default: DEFAULT_FLOW_STYLE
Parent method: DumpSettingsBuilder.setDefaultFlowStyle(FlowStyle)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): node styles
flowStyle - the flow style to useDumpSettingsBuilder.setDefaultFlowStyle(FlowStyle)public DumperSettings.Builder setScalarStyle(@NotNull org.snakeyaml.engine.v2.common.ScalarStyle scalarStyle)
For additional information please refer to documentation of the parent method listed below.
Default: DEFAULT_SCALAR_STYLE
Parent method: DumpSettingsBuilder.setDefaultScalarStyle(ScalarStyle)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): for
BLOCK flow style, for
FLOW flow style
scalarStyle - the scalar style to useDumpSettingsBuilder.setDefaultScalarStyle(ScalarStyle)public DumperSettings.Builder setStartMarker(boolean startMarker)
---). If there are any directives to be dumped,
it is added automatically.
For additional information please refer to documentation of the parent method listed below.
Default: DEFAULT_START_MARKER
Parent method: DumpSettingsBuilder.setExplicitStart(boolean)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): document
markers
startMarker - if to forcefully add document start markerDumpSettingsBuilder.setExplicitStart(boolean)public DumperSettings.Builder setEndMarker(boolean endMarker)
...).
For additional information please refer to documentation of the parent method listed below.
Default: DEFAULT_END_MARKER
Parent method: DumpSettingsBuilder.setExplicitEnd(boolean)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): document
markers
endMarker - if to forcefully add document end markerDumpSettingsBuilder.setExplicitEnd(boolean)public DumperSettings.Builder setScalarResolver(@NotNull org.snakeyaml.engine.v2.resolver.ScalarResolver resolver)
For additional information please refer to documentation of the parent method listed below.
Default: defined by the parent method
Parent method: DumpSettingsBuilder.setScalarResolver(ScalarResolver)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): JSON schema tags, failsafe schema tags
resolver - the resolver to setDumpSettingsBuilder.setScalarResolver(ScalarResolver)public DumperSettings.Builder setRootTag(@Nullable org.snakeyaml.engine.v2.nodes.Tag rootTag)
As this library does not support anything other than Map (represented by section) as the top-level
object, the given tag must be referring to a class implementing Map interface, serious issues will
occur otherwise (the given tag is not validated).
If null, does not dump any tag for the root section (which will make the resolver resolve it
automatically when the document's loaded next time).
For additional information please refer to documentation of the parent method listed below.
Default: DEFAULT_ROOT_TAG
Parent method: DumpSettingsBuilder.setExplicitRootTag(Optional)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): JSON schema tags, failsafe schema tags
rootTag - the root section tag (type)DumpSettingsBuilder.setExplicitRootTag(Optional)public DumperSettings.Builder setYamlDirective(@Nullable org.snakeyaml.engine.v2.common.SpecVersion directive)
%YAML) directive. If null, does not dump any explicit version
directive.
SnakeYAML Engine supports YAML v1.2 only, however, per the Engine specification, most of the older YAML can be processed. Always refer to the Engine's documentation for more information. To avoid problems, update to 1.2 for full support, please.
For additional information please refer to documentation of the parent method listed below.
Default: defined by the parent method
Parent method: DumpSettingsBuilder.setYamlDirective(Optional)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): YAML
directives
directive - the version directiveDumpSettingsBuilder.setYamlDirective(Optional)public DumperSettings.Builder setTagDirectives(@NotNull Map<String,String> directives)
%TAG) directives in form of a map, where key is the !handle!
(including the exclamation marks) and value the prefix (per the YAML spec).
If there were any tag directives set previously, they are all overwritten.
For additional information please refer to documentation of the parent method listed below.
Default: defined by the parent method
Parent method: DumpSettingsBuilder.setTagDirective(Map)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): TAG
directives
directives - the tag directivesDumpSettingsBuilder.setTagDirective(Map)public DumperSettings.Builder setCanonicalForm(boolean canonical)
Though there is no information and/or specification regarding "canonical form", if enabled (according to experiment shown at the wiki), the dumped file looks as if:
setFlowStyle(FlowStyle) is set to FlowStyle.FLOW,setScalarStyle(ScalarStyle) is set to ScalarStyle.DOUBLE_QUOTED,setMultilineStyle(boolean) is enabled,setMaxSimpleKeyLength(int) is set to 1,setStartMarker(boolean) is enabled.For additional information please refer to documentation of the parent method listed below.
Default: DEFAULT_CANONICAL
Parent method: DumpSettingsBuilder.setCanonical(boolean)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): canonical form
canonical - if to use canonical formDumpSettingsBuilder.setCanonical(boolean)public DumperSettings.Builder setMultilineStyle(boolean multilineStyle)
FlowStyle.FLOW.
For additional information please refer to documentation of the parent method listed below.
Default: DEFAULT_MULTILINE_FORMAT
Parent method: DumpSettingsBuilder.setMultiLineFlow(boolean)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
multilineStyle - if to use multiline formatDumpSettingsBuilder.setMultiLineFlow(boolean)public DumperSettings.Builder setEncoding(@NotNull DumperSettings.Encoding encoding)
For additional information regarding this option and charsets, please refer to documentation of the parent method listed below.
Default: DEFAULT_ENCODING
Parent method: DumpSettingsBuilder.setUseUnicodeEncoding(boolean)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): character
sets
encoding - the encoding to useDumpSettingsBuilder.setUseUnicodeEncoding(boolean)public DumperSettings.Builder setIndentation(int spaces)
For additional information please refer to documentation of the parent method listed below.
Default: DEFAULT_INDENTATION
Parent method: DumpSettingsBuilder.setIndent(int)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): indentation
spaces - amount of spaces per one indentation levelDumpSettingsBuilder.setUseUnicodeEncoding(boolean),
docs
for the wrapped methodpublic DumperSettings.Builder setIndicatorIndentation(int spaces)
0, disables indicator indentation.
For additional information regarding this option and indicators, please refer to documentation of the parent method listed below.
Default: DEFAULT_INDICATOR_INDENTATION
Parent method: DumpSettingsBuilder.setIndent(int)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): indentation,
indicators
spaces - amount of spaces to use to indent indicatorsDumpSettingsBuilder.setIndicatorIndent(int),
docs
for the wrapped methodpublic DumperSettings.Builder setLineWidth(int width)
If the given value is less than or equal to 0, disables the limit and therefore, allows for
theoretically unlimited line lengths (up to Integer.MAX_VALUE).
For additional information, please refer to documentation of the parent method listed below.
Default: DEFAULT_MAX_LINE_WIDTH
Parent method: DumpSettingsBuilder.setWidth(int)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
width - preferred line widthDumpSettingsBuilder.setWidth(int),
docs
for the wrapped methodpublic DumperSettings.Builder setLineBreak(@NotNull String lineBreak)
For additional information, please refer to documentation of the parent method listed below.
Default: defined by the parent method
Parent method: DumpSettingsBuilder.setBestLineBreak(String)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
lineBreak - line breakDumpSettingsBuilder.setBestLineBreak(String)public DumperSettings.Builder setMaxSimpleKeyLength(int length)
?).
If the given value is less than or equal to 0, disables the limit and therefore, allows for keys
of length up to 1024 (limit enforced by the YAML spec). If any value greater than
1018 is given, an IllegalArgumentException will be thrown (not a typo - the limit here
is lower as there is some "processing").
For additional information, please refer to documentation of the parent method listed below.
Default: DEFAULT_MAX_SIMPLE_KEY_LENGTH
Parent method: DumpSettingsBuilder.setMaxSimpleKeyLength(int)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): explicit
keys
length - maximum length for simple key formatDumpSettingsBuilder.setMaxSimpleKeyLength(int)public DumperSettings.Builder setEscapeUnprintable(boolean escape)
For additional information, please refer to documentation of the parent method listed below.
Default: DEFAULT_ESCAPE_UNPRINTABLE
Parent method: DumpSettingsBuilder.setNonPrintableStyle(NonPrintableStyle)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): character
sets
escape - if to escape rather than dumping as binaryDumpSettingsBuilder.setNonPrintableStyle(NonPrintableStyle)public DumperSettings.Builder setUnprintableStyle(@NotNull org.snakeyaml.engine.v2.common.NonPrintableStyle style)
For additional information, please refer to documentation of the parent method listed below.
Default: corresponding to DEFAULT_ESCAPE_UNPRINTABLE
Alias method: setEscapeUnprintable(boolean)
Parent method: DumpSettingsBuilder.setNonPrintableStyle(NonPrintableStyle)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): character
sets
style - style to useDumpSettingsBuilder.setNonPrintableStyle(NonPrintableStyle)public DumperSettings build()
Copyright © 2022. All rights reserved.