public final class LoadSettingsBuilder extends Object
| Modifier and Type | Method and Description |
|---|---|
LoadSettings |
build()
Build immutable LoadSettings
|
LoadSettingsBuilder |
setAllowDuplicateKeys(boolean allowDuplicateKeys)
YAML 1.2 does require unique keys.
|
LoadSettingsBuilder |
setAllowRecursiveKeys(boolean allowRecursiveKeys)
Allow only non-recursive keys for maps and sets.
|
LoadSettingsBuilder |
setBufferSize(Integer bufferSize)
Buffer size for incoming data stream.
|
LoadSettingsBuilder |
setCodePointLimit(int codePointLimit)
The max amount of code points in the input YAML document.
|
LoadSettingsBuilder |
setCustomProperty(SettingKey key,
Object value)
Provide a custom property to be used later
|
LoadSettingsBuilder |
setDefaultList(IntFunction<List<Object>> defaultList)
Provide default List implementation.
|
LoadSettingsBuilder |
setDefaultMap(IntFunction<Map<Object,Object>> defaultMap)
Provide default Map implementation.
|
LoadSettingsBuilder |
setDefaultSet(IntFunction<Set<Object>> defaultSet)
Provide default Set implementation.
|
LoadSettingsBuilder |
setEnvConfig(Optional<EnvConfig> envConfig)
Define EnvConfig to parse EVN format.
|
LoadSettingsBuilder |
setLabel(String label)
Label for the input data.
|
LoadSettingsBuilder |
setMaxAliasesForCollections(int maxAliasesForCollections)
Restrict the number of aliases for collection nodes to prevent Billion laughs attack.
|
LoadSettingsBuilder |
setParseComments(boolean parseComments)
Parse comments to the presentation tree (Node).
|
LoadSettingsBuilder |
setScalarResolver(ScalarResolver scalarResolver)
Provide resolver to detect a tag by the value of a scalar
|
LoadSettingsBuilder |
setTagConstructors(Map<org.snakeyaml.engine.v2.nodes.Tag,ConstructNode> tagConstructors)
Provide constructors for the specified tags.
|
LoadSettingsBuilder |
setUseMarks(boolean useMarks)
Marks are only used for error messages.
|
LoadSettingsBuilder |
setVersionFunction(UnaryOperator<SpecVersion> versionFunction)
Manage YAML directive value which defines the version of the YAML specification.
|
public LoadSettingsBuilder setLabel(String label)
label - - meaningful label to indicate the input sourcepublic LoadSettingsBuilder setTagConstructors(Map<org.snakeyaml.engine.v2.nodes.Tag,ConstructNode> tagConstructors)
tagConstructors - - the map from a Tag to its constructorpublic LoadSettingsBuilder setScalarResolver(ScalarResolver scalarResolver)
scalarResolver - - specified ScalarResolverpublic LoadSettingsBuilder setDefaultList(IntFunction<List<Object>> defaultList)
ArrayList is used if nothing provided.defaultList - - specified List implementation (as a function from init size)public LoadSettingsBuilder setDefaultSet(IntFunction<Set<Object>> defaultSet)
LinkedHashSet is used if nothing provided.defaultSet - - specified Set implementation (as a function from init size)public LoadSettingsBuilder setDefaultMap(IntFunction<Map<Object,Object>> defaultMap)
LinkedHashMap is used if nothing provided.defaultMap - - specified Map implementation (as a function from init size)public LoadSettingsBuilder setBufferSize(Integer bufferSize)
bufferSize - - buffer size (in bytes) for input datapublic LoadSettingsBuilder setAllowDuplicateKeys(boolean allowDuplicateKeys)
allowDuplicateKeys - - if true than the non-unique keys in a mapping are allowed (last key
wins). False by default.public LoadSettingsBuilder setAllowRecursiveKeys(boolean allowRecursiveKeys)
allowRecursiveKeys - - true to allow recursive structures as keyspublic LoadSettingsBuilder setMaxAliasesForCollections(int maxAliasesForCollections)
maxAliasesForCollections - - max number of aliases. More then 50 might be very dangerous.
Default is 50public LoadSettingsBuilder setUseMarks(boolean useMarks)
useMarks - - use false to save resources but use less informative error messages (no line
and context)public LoadSettingsBuilder setVersionFunction(UnaryOperator<SpecVersion> versionFunction)
This function allows to control the version management. For instance if the document contains old version the parser can be adapted to compensate the problem. Or it can fail to indicate that the incoming version is not supported.
versionFunction - - define the way to manage the YAML version. By default, 1.* versions
are accepted and treated as YAML 1.2. Other versions fail to parse (YamlVersionException
is thown)public LoadSettingsBuilder setEnvConfig(Optional<EnvConfig> envConfig)
envConfig - - non-empty configuration to substitute variablespublic LoadSettingsBuilder setCustomProperty(SettingKey key, Object value)
key - - the keyvalue - - the value behind the keypublic LoadSettingsBuilder setParseComments(boolean parseComments)
parseComments - - use true to parse comments to the presentation tree (Node)public LoadSettingsBuilder setCodePointLimit(int codePointLimit)
codePointLimit - - the max allowed size of the YAML datapublic LoadSettings build()
Copyright © 2018–2022. All rights reserved.