public class MemoryConfiguration extends MemorySection implements Configuration
Configuration implementation that does not save or load
from any source, and stores all values in memory only.
This is useful for temporary Configurations for
providing defaults.
Synchronized with the commit on 07-June-2022.
| Modifier and Type | Field and Description |
|---|---|
protected Configuration |
defs |
protected MemoryConfigurationOptions |
options |
map| Constructor and Description |
|---|
MemoryConfiguration()
Creates an empty
MemoryConfiguration with no default values. |
MemoryConfiguration(@Nullable Configuration defs)
Creates an empty
MemoryConfiguration using the specified
Configuration as a source for all default values. |
| Modifier and Type | Method and Description |
|---|---|
void |
addDefault(@NotNull String path,
@Nullable Object value)
Sets the default value in the root at the given path as provided.
|
void |
addDefaults(@NotNull Configuration defs)
Sets the default values of the given paths as provided.
|
void |
addDefaults(@NotNull Map<String,Object> defs)
Sets the default values of the given paths as provided.
|
@Nullable Configuration |
getDefaults()
Gets the source
Configuration for this Configuration. |
@NotNull MemoryConfigurationOptions |
getOptions()
Gets the
ConfigurationOptions for this Configuration. |
@Nullable ConfigurationSection |
getParent()
Gets the parent
ConfigurationSection that directly contains
this ConfigurationSection. |
@NotNull MemoryConfigurationOptions |
options()
Deprecated.
|
void |
setDefaults(@NotNull Configuration defs)
Sets the source of all default values for this
Configuration. |
contains, contains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByte, getByte, getByteList, getChar, getChar, getCharList, getComments, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, getInLineComments, getInt, getInt, getIntList, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getRoot, getSerializable, getSerializable, getShort, getShort, getShortList, getString, getString, getStringList, getValues, isBoolean, isByte, isChar, isConfigurationSection, isDouble, isFloat, isInt, isList, isLong, isSet, isShort, isString, mapChildrenKeys, mapChildrenValues, set, setComments, setInLineComments, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, contains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByte, getByte, getByteList, getChar, getChar, getCharList, getComments, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, getInLineComments, getInt, getInt, getIntList, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getRoot, getSerializable, getSerializable, getShort, getShort, getShortList, getString, getString, getStringList, getValues, isBoolean, isByte, isChar, isConfigurationSection, isDouble, isFloat, isInt, isList, isLong, isSet, isShort, isString, set, setComments, setInLineCommentsprotected Configuration defs
protected MemoryConfigurationOptions options
public MemoryConfiguration()
MemoryConfiguration with no default values.MemorySection()public MemoryConfiguration(@Nullable
@Nullable Configuration defs)
MemoryConfiguration using the specified
Configuration as a source for all default values.defs - The default value provider.MemorySection()public void addDefault(@NotNull
@NotNull String path,
@Nullable
@Nullable Object value)
If no source Configuration was provided as a default
collection, then a new MemoryConfiguration will be created to
hold the new default value.
If value is null, the value will be removed from the default
Configuration source.
If the value as returned by
ConfigurationSection.getDefaultSection() is null, then
this will create a new ConfigurationSection at the path,
replacing anything that may have existed there previously.
addDefault in interface ConfigurationaddDefault in interface ConfigurationSectionaddDefault in class MemorySectionpath - The path of the value to set.value - The value to set the default to.public void addDefaults(@NotNull
@NotNull Map<String,Object> defs)
If no source Configuration was provided as a default
collection, then a new MemoryConfiguration will be created to
hold the new default values.
addDefaults in interface Configurationdefs - A Map of Path->Values to add to the
defaults.public void addDefaults(@NotNull
@NotNull Configuration defs)
If no source Configuration was provided as a default
collection, then a new MemoryConfiguration will be created to
hold the new default value.
This method will not hold a reference to the specified
Configuration, nor will it automatically update if that
Configuration ever changes. If you require this, you should set
the default source with Configuration.setDefaults(Configuration).
addDefaults in interface Configurationdefs - A Configuration holding a list of defaults to copy.public void setDefaults(@NotNull
@NotNull Configuration defs)
Configuration.
If a previous source was set, or previous default values were defined, then they will not be copied to the new source.
setDefaults in interface Configurationdefs - New source of default values for this Configuration.@Nullable public @Nullable Configuration getDefaults()
Configuration for this Configuration.
If no configuration source was set, but default values were added, then
a MemoryConfiguration will be returned. If no source was set
and no defaults were set, then this method will return null.
getDefaults in interface ConfigurationConfiguration source for default values, or
null if none exist.@Nullable public @Nullable ConfigurationSection getParent()
ConfigurationSection that directly contains
this ConfigurationSection.
For any Configuration themselves, this will return null.
If this ConfigurationSection is no longer contained within its
parent for any reason, such as being replaced with a different value,
this may return null.
getParent in interface ConfigurationSectiongetParent in class MemorySectionConfigurationSection containing this
ConfigurationSection.@NotNull public @NotNull MemoryConfigurationOptions getOptions()
ConfigurationOptions for this Configuration.
All setters through this method are chainable.
getOptions in interface ConfigurationConfigurationOptions for this Configuration.@Deprecated @NotNull public @NotNull MemoryConfigurationOptions options()
Please use Configuration.getOptions() instead; it provides the
same functionality.
options in interface ConfigurationConfigurationOptions for this Configuration.Configuration.getOptions()Copyright © 2023 BSPF Systems, LLC. All rights reserved.