public final class YamlConfigurationOptions extends FileConfigurationOptions
Synchronized with the commit on 07-June-2022.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CODE_POINT_LIMIT |
static int |
DEFAULT_INDENT |
static int |
DEFAULT_MAX_ALIASES |
static int |
DEFAULT_WIDTH |
DEFAULT_FOOTER, DEFAULT_HEADER, DEFAULT_PARSE_COMMENTSDEFAULT_COPY_DEFAULTS, DEFAULT_PATH_SEPARATOR| Modifier and Type | Method and Description |
|---|---|
int |
getCodePointLimit()
Gets the maximum number of code points that can be loaded in at one time.
|
@NotNull YamlConfiguration |
getConfiguration()
Gets the configuration that these options controls.
|
int |
getIndent()
Gets the number of spaces used to represent an indent.
|
int |
getMaxAliases()
Gets the maximum number of aliases for collections.
|
int |
getWidth()
Gets how long a line can be before it gets split.
|
@NotNull YamlConfigurationOptions |
setCodePointLimit(int codePointLimit)
Sets the maximum number of code points that can be loaded in at one time.
|
@NotNull YamlConfigurationOptions |
setCopyDefaults(boolean copyDefaults)
Sets if the configuration should copy values from its default
configuration directly.
|
@NotNull YamlConfigurationOptions |
setFooter(@Nullable List<String> footer)
Assigns the given footer comments to these file configuration options.
|
@NotNull YamlConfigurationOptions |
setHeader(@Nullable List<String> header)
Assigns the given header comments to these file configuration options.
|
@NotNull YamlConfigurationOptions |
setIndent(int indent)
Sets the number of spaces used to represent an indent.
|
@NotNull YamlConfigurationOptions |
setMaxAliases(int maxAliases)
Sets the maximum number of aliases for collections.
|
@NotNull YamlConfigurationOptions |
setParseComments(boolean parseComments)
Sets whether the comments (header, block, inline, and/or footer) in a
file configuration should be loaded and saved.
|
@NotNull YamlConfigurationOptions |
setPathSeparator(char pathSeparator)
Sets the
char that will be used to separate configuration
sections. |
@NotNull YamlConfigurationOptions |
setWidth(int width)
Sets how long a line can be before it gets split.
|
getFooter, getHeader, getParseCommentsgetCopyDefaults, getPathSeparatorpublic static final int DEFAULT_INDENT
public static final int DEFAULT_WIDTH
public static final int DEFAULT_MAX_ALIASES
public static final int DEFAULT_CODE_POINT_LIMIT
@NotNull public @NotNull YamlConfiguration getConfiguration()
getConfiguration in class FileConfigurationOptions@NotNull public @NotNull YamlConfigurationOptions setPathSeparator(char pathSeparator)
char that will be used to separate configuration
sections.
This value does not affect how the configuration is stored, only in how you access the data.
The default value is ..
setPathSeparator in class FileConfigurationOptionspathSeparator - The char used to separate configuration
sections.@NotNull public @NotNull YamlConfigurationOptions setCopyDefaults(boolean copyDefaults)
If this is true, all values in the default configuration will be
directly copied, making it impossible to distinguish between values that
were set and values that are provided by default. As a result,
ConfigurationSection.contains(String) will always return the same
value as ConfigurationSection.isSet(String).
The default value is false.
setCopyDefaults in class FileConfigurationOptionscopyDefaults - true if the default values should be copied,
false otherwise.@NotNull public @NotNull YamlConfigurationOptions setHeader(@Nullable @Nullable List<String> header)
null, an empty list will be assigned.
For the individual string entries in the list; a null entry
represents an empty line, whereas an empty string entry represents an
empty header comment line (# and nothing else). Each entry in the
list represents 1 line of header comments.
The given list will not be directly saved; instead, a snapshot will be taken and used to create an unmodifiable copy internally. Further updates to the given list will not result in changes to the inline comments stored in these file configuration options after this method completes.
Any existing header comments will be replaced, regardless of their value(s) compared to the new header comments.
setHeader in class FileConfigurationOptionsheader - The header comments to assign to these file configuration
options.@NotNull public @NotNull YamlConfigurationOptions setFooter(@Nullable @Nullable List<String> footer)
null, an empty list will be assigned.
For the individual string entries in the list; a null entry
represents an empty line, whereas an empty string entry represents an
empty footer comment line (# and nothing else). Each entry in the
list represents 1 line of footer comments.
The given list will not be directly saved; instead, a snapshot will be taken and used to create an unmodifiable copy internally. Further updates to the given list will not result in changes to the inline comments stored in these file configuration options after this method completes.
Any existing footer comments will be replaced, regardless of their value(s) compared to the new footer comments.
setFooter in class FileConfigurationOptionsfooter - The footer comments to assign to these file configuration
options.@NotNull public @NotNull YamlConfigurationOptions setParseComments(boolean parseComments)
If this is true, and if a default file configuration is passed to
Configuration.setDefaults(Configuration), then upon saving, the
default comments will be parsed from the passed default file
configuration, instead of the ones provided in here.
If no default is set on the configuration, or the default is not a file configuration, or that configuration has no comments, then the comments specified in the original configuration will be used.
The default value is true.
setParseComments in class FileConfigurationOptionsparseComments - true if the comments are to be parsed,
false otherwise.public int getIndent()
The minimum value this may be is 2, and the maximum is 9.
The default value is 2.
@NotNull public @NotNull YamlConfigurationOptions setIndent(int indent) throws IllegalArgumentException
The minimum value this may be is 2, and the maximum is 9.
The default value is 2.
indent - The number of spaces used to represent an indent.IllegalArgumentException - If the given value is less than
2 or greater than 9.public int getWidth()
The minimum value this may be is 8, and the maximum is
1000.
The default value is 80.
@NotNull public @NotNull YamlConfigurationOptions setWidth(int width)
The minimum value this may be is 8, and the maximum is
1000.
The default value is 80.
width - The number of characters a line can be before it gets split.IllegalArgumentException - If the given value is less than
8 or greater than 1000.public int getMaxAliases()
The minimum value this may be is 10, and the maximum is
Integer.MAX_VALUE.
The default value is 50. It is recommended to keep this value as
low as possible for your use case as to prevent a Denial-of-Service known
Billion Laughs Attack.
@NotNull public @NotNull YamlConfigurationOptions setMaxAliases(int maxAliases) throws IllegalArgumentException
The minimum value this may be is 10, and the maximum is
Integer.MAX_VALUE (please use this wisely).
A recommended value is 50. It is recommended to keep this value
as low as possible for your use case as to prevent a Denial-of-Service
known
Billion Laughs Attack.
maxAliases - The maximum number of aliases for collections.IllegalArgumentException - If the given value is less than 10.public int getCodePointLimit()
The minimum is 1kB (1024), and the maximum is
Integer.MAX_VALUE (please use this wisely).
A recommended value is 3 MB (1024 * 1024 * 3).
@NotNull public @NotNull YamlConfigurationOptions setCodePointLimit(int codePointLimit) throws IllegalArgumentException
The minimum is 1kB (1024), and the maximum is
Integer.MAX_VALUE (please use this wisely).
A recommended value is 3 MB (1024 * 1024 * 3).
codePointLimit - The maximum number of code points for loading.IllegalArgumentException - If the given value is less than
1kB (1024).Copyright © 2024 BSPF Systems, LLC. All rights reserved.