LoaderSettings
Loader settings cover all options related explicitly (only) to file loading.
Creating a builder
Settings introduced by BoostedYAML follow builder design pattern, e.g. you may build your own settings using:
LoaderSettings.builder() /*configure*/ .build()
Basic settings
Create file if absent
Builder#setCreateFileIfAbsent(boolean createFileIfAbsent)
Sets if to create a new file and save it if it does not exist automatically.
Not effective if there is no file associated with the document.
Default: true
(enabled)
Update automatically
Builder#setAutoUpdate(boolean autoUpdate)
If enabled, automatically calls YamlFile#update()
after the document has been loaded.
Not effective if there are no defaults associated with the document.
Default: false
(disabled)
Advanced settings
Error labels
Builder#setErrorLabel(@NotNull String label)
Sets custom label for error messages.
Default: defined by the parent method Parent method docs (v2.3): click Related YAML spec (v1.2.2): -
Detailed errors
Builder#setDetailedErrors(boolean detailedErrors)
Sets if to print detailed error messages.
Default: true
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
Allow duplicate keys
Builder#setAllowDuplicateKeys(boolean allowDuplicateKeys)
Sets if to allow duplicate keys in sections (last key wins when loading).
Default: true
Parent method docs (v2.3): click
Related YAML spec (v1.2.2): -
Max collection aliases
Builder#setMaxCollectionAliases(int maxCollectionAliases)
Sets maximum aliases a collection can have to prevent memory leaks (see Billion laughs attack).
Default: defined by the parent method Parent method docs (v2.3): click Related YAML spec (v1.2.2): -
Tag constructors
Builder#setTagConstructors(@NotNull Map<Tag, ConstructNode> constructors)
Sets custom node to Java object constructors, per YAML tag.
Default: defined by the parent method Parent method docs (v2.3): click Related YAML spec (v1.2.2): JSON schema tags, failsafe schema tags
Schema
Builder#setSchema(@NotNull Schema schema)
Sets custom schema to use. Schemas are used to resolve and determine object tags contained within a document. This setting replaces setScalarResolver
available until the 1.3.6 release.
Default: defined by the parent method Parent method docs (v2.7): click Related YAML spec (v1.2.2): JSON schema tags, failsafe schema tags
Environment config
Builder#setEnvironmentConfig(@Nullable EnvConfig envConfig)
Sets custom environment variable config.
Default: defined by the parent method Parent method docs (v2.3): click Related YAML spec (v1.2.2): -
Last updated