Class FileConfigurationOptions
- Direct Known Subclasses:
YamlConfigurationOptions
Synchronized with the commit on 20-December-2021.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanFields inherited from class org.bspfsystems.yamlconfiguration.configuration.ConfigurationOptions
DEFAULT_COPY_DEFAULTS, DEFAULT_PATH_SEPARATOR -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFileConfigurationOptions(@NotNull MemoryConfiguration configuration) Constructs a set of file configuration options. -
Method Summary
Modifier and TypeMethodDescription@NotNull FileConfigurationGets the configuration that these options controls.Gets the footer comments that will be saved at the top of the output file configuration.Gets the header comments that will be saved at the top of the output file configuration.final booleanGets whether the comments (header, block, inline, and/or footer) in a file configuration should be loaded and saved.@NotNull FileConfigurationOptionssetCopyDefaults(boolean copyDefaults) Sets if the configuration should copy values from its default configuration directly.@NotNull FileConfigurationOptionsAssigns the given footer comments to these file configuration options.@NotNull FileConfigurationOptionsAssigns the given header comments to these file configuration options.@NotNull FileConfigurationOptionssetParseComments(boolean parseComments) Sets whether the comments (header, block, inline, and/or footer) in a file configuration should be loaded and saved.@NotNull FileConfigurationOptionssetPathSeparator(char pathSeparator) Sets thecharthat will be used to separate configuration sections.Methods inherited from class org.bspfsystems.yamlconfiguration.configuration.ConfigurationOptions
getCopyDefaults, getPathSeparator
-
Field Details
-
DEFAULT_HEADER
-
DEFAULT_FOOTER
-
DEFAULT_PARSE_COMMENTS
public static final boolean DEFAULT_PARSE_COMMENTS- See Also:
-
-
Constructor Details
-
FileConfigurationOptions
Constructs a set of file configuration options.- Parameters:
configuration- The file configuration to create the options for.- See Also:
-
-
Method Details
-
getConfiguration
Gets the configuration that these options controls.- Overrides:
getConfigurationin classMemoryConfigurationOptions- Returns:
- The configuration that these options controls.
-
setPathSeparator
Sets thecharthat 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
..- Overrides:
setPathSeparatorin classMemoryConfigurationOptions- Parameters:
pathSeparator- Thecharused to separate configuration sections.- Returns:
- These options, for chaining.
-
setCopyDefaults
Sets if the configuration should copy values from its default configuration directly.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 asConfigurationSection.isSet(String).The default value is
false.- Overrides:
setCopyDefaultsin classMemoryConfigurationOptions- Parameters:
copyDefaults-trueif the default values should be copied,falseotherwise.- Returns:
- These options, for chaining.
-
getHeader
Gets the header comments that will be saved at the top of the output file configuration. If no header comments exist, an empty list will be returned.For the individual string entries in the list; a
nullentry 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.
- Returns:
- The header comments for the file configuration controlled by this file configuration options.
-
setHeader
@NotNull public @NotNull FileConfigurationOptions setHeader(@Nullable @Nullable List<String> header) Assigns the given header comments to these file configuration options. If the given list isnull, an empty list will be assigned.For the individual string entries in the list; a
nullentry 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.
- Parameters:
header- The header comments to assign to these file configuration options.- Returns:
- These file configuration options, for chaining.
-
getParseComments
public final boolean getParseComments()Gets whether the comments (header, block, inline, and/or footer) in a file configuration should be loaded and saved.If this returns
true, and if a default file configuration is passed toConfiguration.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.- Returns:
trueif the comments are to be parsed,falseotherwise.
-
setParseComments
Sets whether the comments (header, block, inline, and/or footer) in a file configuration should be loaded and saved.If this is
true, and if a default file configuration is passed toConfiguration.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.- Parameters:
parseComments-trueif the comments are to be parsed,falseotherwise.- Returns:
- This file configuration options, for chaining.
-