public class FileConfigurationOptions extends MemoryConfigurationOptions
Synchronized with the commit on 20-December-2021.
| Modifier and Type | Field and Description |
|---|---|
static List<String> |
DEFAULT_FOOTER |
static List<String> |
DEFAULT_HEADER |
static boolean |
DEFAULT_PARSE_COMMENTS |
DEFAULT_COPY_DEFAULTS, DEFAULT_PATH_SEPARATOR| Modifier | Constructor and Description |
|---|---|
protected |
FileConfigurationOptions(@NotNull MemoryConfiguration configuration)
Constructs a set of file configuration options.
|
| Modifier and Type | Method and Description |
|---|---|
@NotNull FileConfiguration |
getConfiguration()
Gets the configuration that these options controls.
|
@NotNull @UnmodifiableView List<String> |
getFooter()
Gets the footer comments that will be saved at the top of the output file
configuration.
|
@NotNull @UnmodifiableView List<String> |
getHeader()
Gets the header comments that will be saved at the top of the output file
configuration.
|
boolean |
getParseComments()
Gets whether the comments (header, block, inline, and/or footer) in a
file configuration should be loaded and saved.
|
@NotNull FileConfigurationOptions |
setCopyDefaults(boolean copyDefaults)
Sets if the configuration should copy values from its default
configuration directly.
|
@NotNull FileConfigurationOptions |
setFooter(@Nullable List<String> footer)
Assigns the given footer comments to these file configuration options.
|
@NotNull FileConfigurationOptions |
setHeader(@Nullable List<String> header)
Assigns the given header comments to these file configuration options.
|
@NotNull FileConfigurationOptions |
setParseComments(boolean parseComments)
Sets whether the comments (header, block, inline, and/or footer) in a
file configuration should be loaded and saved.
|
@NotNull FileConfigurationOptions |
setPathSeparator(char pathSeparator)
Sets the
char that will be used to separate configuration
sections. |
getCopyDefaults, getPathSeparatorpublic static final boolean DEFAULT_PARSE_COMMENTS
protected FileConfigurationOptions(@NotNull
@NotNull MemoryConfiguration configuration)
configuration - The file configuration to create the options for.MemoryConfigurationOptions(MemoryConfiguration)@NotNull public @NotNull FileConfiguration getConfiguration()
getConfiguration in class MemoryConfigurationOptions@NotNull public @NotNull FileConfigurationOptions 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 MemoryConfigurationOptionspathSeparator - The char used to separate configuration
sections.@NotNull public @NotNull FileConfigurationOptions 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 MemoryConfigurationOptionscopyDefaults - true if the default values should be copied,
false otherwise.@NotNull public final @NotNull @UnmodifiableView List<String> getHeader()
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 list cannot be modified. The returned list represents a snapshot of the header comments at the time the list was returned; any changes to the actual header comments will not be reflected in this list.
@NotNull public @NotNull FileConfigurationOptions 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.
header - The header comments to assign to these file configuration
options.@NotNull public final @NotNull @UnmodifiableView List<String> getFooter()
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 list cannot be modified. The returned list represents a snapshot of the footer comments at the time the list was returned; any changes to the actual footer comments will not be reflected in this list.
@NotNull public @NotNull FileConfigurationOptions 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.
footer - The footer comments to assign to these file configuration
options.public final boolean getParseComments()
If this returns 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.
true if the comments are to be parsed, false
otherwise.@NotNull public @NotNull FileConfigurationOptions 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.
parseComments - true if the comments are to be parsed,
false otherwise.Copyright © 2024 BSPF Systems, LLC. All rights reserved.