public static class LoaderSettings.Builder extends Object
LoadSettingsBuilder class which is more
detailed, provides more options and possibilities, hides options which should not be configured.| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_ALLOW_DUPLICATE_KEYS
If to allow duplicate keys by default.
|
static boolean |
DEFAULT_AUTO_UPDATE
If to automatically update the file after load by default.
|
static boolean |
DEFAULT_CREATE_FILE_IF_ABSENT
If to automatically create a new file if absent by default.
|
static boolean |
DEFAULT_DETAILED_ERRORS
If to print detailed error messages by default.
|
| Modifier and Type | Method and Description |
|---|---|
LoaderSettings |
build()
Builds the settings.
|
LoaderSettings.Builder |
setAllowDuplicateKeys(boolean allowDuplicateKeys)
Sets if to allow duplicate keys in sections (last key wins when loading).
|
LoaderSettings.Builder |
setAutoUpdate(boolean autoUpdate)
If enabled, automatically calls
YamlDocument.update() after the document has been loaded. |
LoaderSettings.Builder |
setCreateFileIfAbsent(boolean createFileIfAbsent)
Sets if to create a new file and save it if it does not exist automatically.
|
LoaderSettings.Builder |
setDetailedErrors(boolean detailedErrors)
Sets if to print detailed error messages.
|
LoaderSettings.Builder |
setEnvironmentConfig(org.snakeyaml.engine.v2.env.EnvConfig envConfig)
Sets custom environment variable config.
|
LoaderSettings.Builder |
setErrorLabel(String label)
Sets custom label for error messages.
|
LoaderSettings.Builder |
setMaxCollectionAliases(int maxCollectionAliases)
Sets maximum aliases a collection can have to prevent memory leaks (see
Billion laughs attack).
|
LoaderSettings.Builder |
setScalarResolver(org.snakeyaml.engine.v2.resolver.ScalarResolver resolver)
Sets custom scalar resolver, used to resolve tags for objects.
|
LoaderSettings.Builder |
setTagConstructors(Map<org.snakeyaml.engine.v2.nodes.Tag,org.snakeyaml.engine.v2.api.ConstructNode> constructors)
Sets custom node to Java object constructors, per YAML tag.
|
public static final boolean DEFAULT_CREATE_FILE_IF_ABSENT
public static final boolean DEFAULT_AUTO_UPDATE
public static final boolean DEFAULT_DETAILED_ERRORS
public static final boolean DEFAULT_ALLOW_DUPLICATE_KEYS
public LoaderSettings.Builder setCreateFileIfAbsent(boolean createFileIfAbsent)
Not effective if there is no file associated with the document.
Default: DEFAULT_CREATE_FILE_IF_ABSENT
createFileIfAbsent - if to create a new file if absentpublic LoaderSettings.Builder setAutoUpdate(boolean autoUpdate)
YamlDocument.update() after the document has been loaded.
Not effective if there are no defaults associated with the document.
Default: DEFAULT_AUTO_UPDATE
autoUpdate - if to automatically update after loadingpublic LoaderSettings.Builder setErrorLabel(@NotNull String label)
For additional information, please refer to documentation of the parent method listed below.
Default: defined by the parent method
Parent method: LoadSettingsBuilder.setLabel(String)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
label - the labelpublic LoaderSettings.Builder setDetailedErrors(boolean detailedErrors)
For additional information, please refer to documentation of the parent method listed below.
Default: DEFAULT_DETAILED_ERRORS
Parent method: LoadSettingsBuilder.setUseMarks(boolean)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
detailedErrors - if to print detailed errorspublic LoaderSettings.Builder setAllowDuplicateKeys(boolean allowDuplicateKeys)
For additional information, please refer to documentation of the parent method listed below.
Default: DEFAULT_ALLOW_DUPLICATE_KEYS
Parent method: LoadSettingsBuilder.setAllowDuplicateKeys(boolean)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
allowDuplicateKeys - if to allow duplicate keyspublic LoaderSettings.Builder setMaxCollectionAliases(int maxCollectionAliases)
For additional information, please refer to documentation of the parent method listed below.
Default: defined by the parent method
Parent method: LoadSettingsBuilder.setMaxAliasesForCollections(int)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
maxCollectionAliases - maximum aliases for collectionspublic LoaderSettings.Builder setTagConstructors(@NotNull Map<org.snakeyaml.engine.v2.nodes.Tag,org.snakeyaml.engine.v2.api.ConstructNode> constructors)
For additional information, please refer to documentation of the parent method listed below.
Default: defined by the parent method
Parent method: LoadSettingsBuilder.setTagConstructors(Map) (int)}
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): JSON schema tags, failsafe schema tags
constructors - constructor mappublic LoaderSettings.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: LoadSettingsBuilder.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 LoaderSettings.Builder setEnvironmentConfig(@Nullable org.snakeyaml.engine.v2.env.EnvConfig envConfig)
For additional information, please refer to documentation of the parent method listed below.
Default: defined by the parent method
Parent method: LoadSettingsBuilder.setEnvConfig(Optional)
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
envConfig - the config to setDumpSettingsBuilder.setScalarResolver(ScalarResolver)public LoaderSettings build()
Copyright © 2022. All rights reserved.