public interface ConfigurationSection
Configuration.
Synchronized with the commit on 20-December-2021.| 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.
|
boolean |
contains(@NotNull String path)
Checks if this
ConfigurationSection contains the given path. |
boolean |
contains(@NotNull String path,
boolean ignoreDefault)
Checks if this
ConfigurationSection contains the given path. |
@NotNull ConfigurationSection |
createSection(@NotNull String path)
Creates an empty
ConfigurationSection at the specified path. |
@NotNull ConfigurationSection |
createSection(@NotNull String path,
@NotNull Map<?,?> map)
Creates a
ConfigurationSection at the specified path, with the
specified values. |
@Nullable Object |
get(@NotNull String path)
Gets the
Object at the given path. |
@Nullable Object |
get(@NotNull String path,
@Nullable Object def)
Gets the
Object at the given path, returning the given default
value if none has been set. |
boolean |
getBoolean(@NotNull String path)
Gets the
boolean value at the given path. |
boolean |
getBoolean(@NotNull String path,
boolean def)
Gets the
boolean value at the given path. |
@NotNull List<Boolean> |
getBooleanList(@NotNull String path)
|
byte |
getByte(@NotNull String path)
Gets the
byte value at the given path. |
byte |
getByte(@NotNull String path,
byte def)
Gets the
byte value at the given path. |
@NotNull List<Byte> |
getByteList(@NotNull String path)
|
char |
getChar(@NotNull String path)
Gets the
char value at the given path. |
char |
getChar(@NotNull String path,
char def)
Gets the
char value at the given path. |
@NotNull List<Character> |
getCharList(@NotNull String path)
Gets the
List of Characters at the given path. |
@NotNull List<String> |
getComments(@NotNull String path)
Gets the requested comment
List by path. |
@Nullable ConfigurationSection |
getConfigurationSection(@NotNull String path)
Gets the
ConfigurationSection value at the given path. |
@Nullable String |
getCurrentPath()
Gets the path of this
ConfigurationSection from its root
Configuration |
@Nullable ConfigurationSection |
getDefaultSection()
|
double |
getDouble(@NotNull String path)
Gets the
double value at the given path. |
double |
getDouble(@NotNull String path,
double def)
Gets the
double value at the given path. |
@NotNull List<Double> |
getDoubleList(@NotNull String path)
|
float |
getFloat(@NotNull String path)
Gets the
float value at the given path. |
float |
getFloat(@NotNull String path,
float def)
Gets the
float value at the given path. |
@NotNull List<Float> |
getFloatList(@NotNull String path)
|
@NotNull List<String> |
getInLineComments(@NotNull String path)
Gets the requested inline comment
List by path. |
int |
getInt(@NotNull String path)
Gets the
int value at the given path. |
int |
getInt(@NotNull String path,
int def)
Gets the
int value at the given path. |
@NotNull List<Integer> |
getIntList(@NotNull String path)
|
@NotNull Set<String> |
getKeys(boolean deep)
Gets a
Set containing all keys in this
ConfigurationSection. |
@Nullable List<?> |
getList(@NotNull String path)
Gets the
List value at the given path. |
@Nullable List<?> |
getList(@NotNull String path,
@Nullable List<?> def)
Gets the
List value at the given path. |
long |
getLong(@NotNull String path)
Gets the
long value at the given path. |
long |
getLong(@NotNull String path,
long def)
Gets the
long value at the given path. |
@NotNull List<Long> |
getLongList(@NotNull String path)
|
@NotNull List<Map<?,?>> |
getMapList(@NotNull String path)
|
@NotNull String |
getName()
Gets the name of this individual
ConfigurationSection, in the
path. |
<T> T |
getObject(@NotNull String path,
@NotNull Class<T> clazz)
Gets the
Object value of type T at the given path. |
<T> T |
getObject(@NotNull String path,
@NotNull Class<T> clazz,
T def)
Gets the
Object value of type T at the given path. |
@Nullable ConfigurationSection |
getParent()
Gets the parent
ConfigurationSection that directly contains
this ConfigurationSection. |
@Nullable Configuration |
getRoot()
Gets the root
Configuration that contains this
ConfigurationSection |
<T extends ConfigurationSerializable> |
getSerializable(@NotNull String path,
@NotNull Class<T> clazz)
Gets the
ConfigurationSerializable value of type T at the
given path. |
<T extends ConfigurationSerializable> |
getSerializable(@NotNull String path,
@NotNull Class<T> clazz,
T def)
Gets the
ConfigurationSerializable value of type T value
at the given path. |
short |
getShort(@NotNull String path)
Gets the
short value at the given path. |
short |
getShort(@NotNull String path,
short def)
Gets the
short value at the given path. |
@NotNull List<Short> |
getShortList(@NotNull String path)
|
@Nullable String |
getString(@NotNull String path)
Gets the
String value at the given path. |
@Nullable String |
getString(@NotNull String path,
@Nullable String def)
Gets the
String value at the given path. |
@NotNull List<String> |
getStringList(@NotNull String path)
|
@NotNull Map<String,Object> |
getValues(boolean deep)
Gets a
Map containing all keys and their values for this
ConfigurationSection. |
boolean |
isBoolean(@NotNull String path)
Checks if the value at the given path is a
boolean. |
boolean |
isByte(@NotNull String path)
Checks if the value at the given path is a
byte. |
boolean |
isChar(@NotNull String path)
Checks if the value at the given path is a
char. |
boolean |
isConfigurationSection(@NotNull String path)
Checks if the value at the given path is a
ConfigurationSection. |
boolean |
isDouble(@NotNull String path)
Checks if the value at the given path is a
double. |
boolean |
isFloat(@NotNull String path)
Checks if the value at the given path is a
float. |
boolean |
isInt(@NotNull String path)
Checks if the value at the given path is an
int. |
boolean |
isList(@NotNull String path)
Checks if the value at the given path is a
List. |
boolean |
isLong(@NotNull String path)
Checks if the value at the given path is a
long. |
boolean |
isSet(@NotNull String path)
Checks if this
ConfigurationSection has a value set for the
given path. |
boolean |
isShort(@NotNull String path)
Checks if the value at the given path is a
short. |
boolean |
isString(@NotNull String path)
Checks if the value at the given path is a
String. |
void |
set(@NotNull String path,
@Nullable Object value)
Sets the specified path to the given value.
|
void |
setComments(@NotNull String path,
@Nullable List<String> comments)
Sets the comment
List at the specified path. |
void |
setInLineComments(@NotNull String path,
@Nullable List<String> inLineComments)
Sets the inline comment
List at the specified path. |
@NotNull @NotNull Set<String> getKeys(boolean deep)
Set containing all keys in this
ConfigurationSection.
If deep is set to true, then the Set will contain
all keys within any child
ConfigurationSection(s) (and their
respective children, etc.) contained within this
ConfigurationSection. The keys will be in a valid path notation
for use.
If deep is set to false, then the Set will
contain only the keys of any direct children, and not any of those
children's children.
deep - true if the Set is to contain the keys of the
children ConfigurationSection(s)
of this ConfigurationSection, false
otherwise.Set of keys contained within this
ConfigurationSection.@NotNull @NotNull Map<String,Object> getValues(boolean deep)
Map containing all keys and their values for this
ConfigurationSection.
If deep is set to true, then the Map will contain
all keys and their respective values within any child
ConfigurationSection(s) (and their
respective children, etc.) contained in this
ConfigurationSection. The keys will be in a valid path notation
for use.
If deep is set to false, then the Map will
contain only the keys and respective values of any direct children, and
not any of those children's children.
deep - true if the Map is to contain the keys and
respective values of the children
ConfigurationSection(s) of this
ConfigurationSection, false otherwise.Map of keys and their respective values contained
within this ConfigurationSection.@Nullable @Nullable String getCurrentPath()
ConfigurationSection from its root
Configuration
For any Configuration themselves, this will return an empty
String.
If this ConfigurationSection is no longer contained within its
root for any reason, such as being replaced with a different value, this
may return null.
To retrieve the single name of this section, that is, the final part of
the path returned by this method, you may use
getName().
ConfigurationSection relative to its root.@NotNull @NotNull String getName()
ConfigurationSection, in the
path.
This will always be the final part of
getCurrentPath(), unless this
ConfigurationSection is orphaned.
ConfigurationSection.@Nullable @Nullable Configuration getRoot()
Configuration that contains this
ConfigurationSection
For any Configuration themselves, this will return its own
object.
If this ConfigurationSection is no longer contained within its
root for any reason, such as being replaced with a different value, this
may return null.
Configuration containing this
ConfigurationSection.@Nullable @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.
ConfigurationSection containing this
ConfigurationSection.@Nullable @Nullable ConfigurationSection getDefaultSection()
ConfigurationSection from the default
Configuration defined in getRoot().
If the root contains no defaults, or the defaults do not contain a
value for this path, or the value at this path is not a
ConfigurationSection, then this will return null.
ConfigurationSection in the default
ConfigurationSection.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
getDefaultSection() is null, then
this will create a new ConfigurationSection at the path,
replacing anything that may have existed there previously.
path - The path of the value to set.value - The value to set the default to.@NotNull @NotNull List<String> getComments(@NotNull @NotNull String path)
List by path.
If no comments exist, and empty List will be returned. A
null entry represents an empty line and an empty String
represents an empty comment line.
path - Path of the comments to get.List of the requested comments, where
every entry represents one line.@NotNull @NotNull List<String> getInLineComments(@NotNull @NotNull String path)
List by path.
If no comments exist, an empty List will be returned. A
null entry represents an empty line and an empty String
represents an empty comment ine.
path - Path of the comments to get.List of the requested comments, where
every entry represents one line.void setComments(@NotNull
@NotNull String path,
@Nullable
@Nullable List<String> comments)
List at the specified path.
If value is null, the comments will be removed. A null
entry is an empty line and an empty String entry is an empty
comment line. If the path does not exist, no comments will be set. Any
existing comments will be replaced, regardless of what the new comments
are.
Some implementations may have limitations on what persists. See their individual javadocs for details.
path - Path of the comments to set.comments - New comments to set at the path, every entry represents
one line.void setInLineComments(@NotNull
@NotNull String path,
@Nullable
@Nullable List<String> inLineComments)
List at the specified path.
If value is null, the comments will be removed. A null
entry is an empty line and an empty String entry is an empty
comment line. If the path does not exist, no comment will be set. Any
existing comments will be replaced, regardless of what the new comments
are.
Some implementations may have limitations on what persists. See their individual javadocs for details.
path - Path of the comments to set.inLineComments - New comments to set at the path, every entry
represents one line.@NotNull @NotNull ConfigurationSection createSection(@NotNull @NotNull String path)
ConfigurationSection at the specified path.
Any value that was previously set at this path will be overwritten. If
the previous value was itself a ConfigurationSection, it will
be orphaned.
path - The path to create the ConfigurationSection at.ConfigurationSection.@NotNull @NotNull ConfigurationSection createSection(@NotNull @NotNull String path, @NotNull @NotNull Map<?,?> map)
ConfigurationSection at the specified path, with the
specified values.
Any value that was previously set at this path will be overwritten. If
the previous value was itself a ConfigurationSection, it will
be orphaned.
path - The path to create the ConfigurationSection at.map - The key-value pairs to place in the
ConfigurationSection.ConfigurationSection.boolean isSet(@NotNull
@NotNull String path)
ConfigurationSection has a value set for the
given path.
If the value for the requested path does not exist but a default value
has been specified, this will still return false.
path - The path to check for existence.true if this ConfigurationSection contains the
requested path, regardless of having a default. false
otherwisevoid set(@NotNull
@NotNull String path,
@Nullable
@Nullable Object value)
If the value is null, the entry will be removed. Any existing
entry will be replaced, regardless of what the new value is.
Some implementations may have limitations on what you may store. See
their individual javadocs for details. No implementations should allow
you to store a Configuration or a ConfigurationSection,
please use createSection(String) for that.
path - The path to the given value.value - The (new) value stored at the given path.boolean contains(@NotNull
@NotNull String path)
ConfigurationSection contains the given path.
If the value for the requested path does not exist but a default value
has been specified, this will return true.
path - The path to check for existence.true if this ConfigurationSection contains the
requested path, either via default or being set. false
otherwise.boolean contains(@NotNull
@NotNull String path,
boolean ignoreDefault)
ConfigurationSection contains the given path.
If true is specified for ignoreDefaults, then this will
return true only if a value has been set for the given path.
If false is specified for ignoreDefaults, then this will
return true if a value has been set for the given path, or if a
default value has been set for the given path.
path - The path to check for existence.ignoreDefault - true if any default values should be ignored
when checking for a value at the path, false
otherwise.true if this ConfigurationSection contains a
value at the requested path, or if a default value has been set
and ignoreDefaults is false. false
otherwise.@Nullable @Nullable Object get(@NotNull @NotNull String path)
Object at the given path.
If a value has not been set at the given path, but a default value has
been set, this will return the default value. If no value and no default
value have been set, this will return null.
@Contract(value="_, !null -> !null") @Nullable @Nullable Object get(@NotNull @NotNull String path, @Nullable @Nullable Object def)
Object at the given path, returning the given default
value if none has been set.
If a value has not been set at the given path, the given default value
will be returned, regardless of whether a default value exists in the
root Configuration.
boolean isBoolean(@NotNull
@NotNull String path)
boolean.
If the value exists at the given path but is not a boolean, this
will return false.
If the value does not exist at the given path but a default value has been set, this will check that value and return appropriately.
path - The path of the boolean to check.true if a boolean value exists, or if there is no
value, a default has been set, and it is a boolean.
false otherwise.boolean getBoolean(@NotNull
@NotNull String path)
boolean value at the given path.
If the value exists at the given path but is not a boolean, this
will return false.
If the value does not exist at the given path, but a default value has been set, this will check that value and return similar to the above.
path - The path of the boolean to retrieve.boolean.boolean getBoolean(@NotNull
@NotNull String path,
boolean def)
boolean value at the given path.
If the value exists at the given path but is not a boolean, or if
the value does not exist at the given path, this will return the given
default.
If a default value has been set in the root Configuration, it
will be ignored, even if the given path does not have a set value.
path - The path of the boolean to retrieve.def - The boolean to use as the default.boolean.boolean isByte(@NotNull
@NotNull String path)
byte.
If the value exists at the given path but is not a byte, this
will return false.
If the value does not exist at the given path but a default value has been set, this will check that value and return appropriately.
path - The path of the byte to check.true if a byte value exists, or if there is no
value, a default has been set, and it is a byte.
false otherwise.byte getByte(@NotNull
@NotNull String path)
byte value at the given path.
If the value exists at the given path but is not a byte, this
will return (byte) 0.
If the value does not exist at the given path, but a default value has been set, this will check that value and return similar to the above.
path - The path of the byte to retrieve.byte.byte getByte(@NotNull
@NotNull String path,
byte def)
byte value at the given path.
If the value exists at the given path but is not a byte, or if
the value does not exist at the given path, this will return the given
default.
If a default value has been set in the root Configuration, it
will be ignored, even if the given path does not have a set value.
path - The path of the byte to retrieve.def - The byte to use as the default.byte.boolean isShort(@NotNull
@NotNull String path)
short.
If the value exists at the given path but is not a short, this
will return false.
If the value does not exist at the given path but a default value has been set, this will check that value and return appropriately.
path - The path of the short to check.true if a short value exists, or if there is no
value, a default has been set, and it is a short.
false otherwise.short getShort(@NotNull
@NotNull String path)
short value at the given path.
If the value exists at the given path but is not a short, this
will return (short) 0.
If the value does not exist at the given path, but a default value has been set, this will check that value and return similar to the above.
path - The path of the short to retrieve.short.short getShort(@NotNull
@NotNull String path,
short def)
short value at the given path.
If the value exists at the given path but is not a short, or if
the value does not exist at the given path, this will return the given
default.
If a default value has been set in the root Configuration, it
will be ignored, even if the given path does not have a set value.
path - The path of the short to retrieve.def - The short to use as the default.short.boolean isInt(@NotNull
@NotNull String path)
int.
If the value exists at the given path but is not an int, this
will return false.
If the value does not exist at the given path but a default value has been set, this will check that value and return appropriately.
path - The path of the int to check.true if an int value exists, or if there is no
value, a default has been set, and it is an int.
false otherwise.int getInt(@NotNull
@NotNull String path)
int value at the given path.
If the value exists at the given path but is not an int, this
will return 0.
If the value does not exist at the given path, but a default value has been set, this will check that value and return similar to the above.
path - The path of the int to retrieve.int.int getInt(@NotNull
@NotNull String path,
int def)
int value at the given path.
If the value exists at the given path but is not an int, or if
the value does not exist at the given path, this will return the given
default.
If a default value has been set in the root Configuration, it
will be ignored, even if the given path does not have a set value.
path - The path of the int to retrieve.def - The int to use as the default.int.boolean isLong(@NotNull
@NotNull String path)
long.
If the value exists at the given path but is not a long, this
will return false.
If the value does not exist at the given path but a default value has been set, this will check that value and return appropriately.
path - The path of the long to check.true if a long value exists, or if there is no
value, a default has been set, and it is a long.
false otherwise.long getLong(@NotNull
@NotNull String path)
long value at the given path.
If the value exists at the given path but is not a long, this
will return 0L.
If the value does not exist at the given path, but a default value has been set, this will check that value and return similar to the above.
path - The path of the long to retrieve.long.long getLong(@NotNull
@NotNull String path,
long def)
long value at the given path.
If the value exists at the given path but is not a long, or if
the value does not exist at the given path, this will return the given
default.
If a default value has been set in the root Configuration, it
will be ignored, even if the given path does not have a set value.
path - The path of the long to retrieve.def - The long to use as the default.long.boolean isFloat(@NotNull
@NotNull String path)
float.
If the value exists at the given path but is not a float, this
will return false.
If the value does not exist at the given path but a default value has been set, this will check that value and return appropriately.
path - The path of the float to check.true if a float value exists, or if there is no
value, a default has been set, and it is a float.
false otherwise.float getFloat(@NotNull
@NotNull String path)
float value at the given path.
If the value exists at the given path but is not a float, this
will return 0.0F.
If the value does not exist at the given path, but a default value has been set, this will check that value and return similar to the above.
path - The path of the float to retrieve.float.float getFloat(@NotNull
@NotNull String path,
float def)
float value at the given path.
If the value exists at the given path but is not a float, or if
the value does not exist at the given path, this will return the given
default.
If a default value has been set in the root Configuration, it
will be ignored, even if the given path does not have a set value.
path - The path of the float to retrieve.def - The float to use as the default.float.boolean isDouble(@NotNull
@NotNull String path)
double.
If the value exists at the given path but is not a double, this
will return false.
If the value does not exist at the given path but a default value has been set, this will check that value and return appropriately.
path - The path of the double to check.true if a double value exists, or if there is no
value, a default has been set, and it is a double.
false otherwise.double getDouble(@NotNull
@NotNull String path)
double value at the given path.
If the value exists at the given path but is not a double, this
will return 0.0D.
If the value does not exist at the given path, but a default value has been set, this will check that value and return similar to the above.
path - The path of the double to retrieve.double.double getDouble(@NotNull
@NotNull String path,
double def)
double value at the given path.
If the value exists at the given path but is not a double, or if
the value does not exist at the given path, this will return the given
default.
If a default value has been set in the root Configuration, it
will be ignored, even if the given path does not have a set value.
path - The path of the double to retrieve.def - The double to use as the default.double.boolean isChar(@NotNull
@NotNull String path)
char.
If the value exists at the given path but is not a char, this
will return false.
If the value does not exist at the given path but a default value has been set, this will check that value and return appropriately.
path - The path of the char to check.true if a char value exists, or if there is no
value, a default has been set, and it is a char.
false otherwise.char getChar(@NotNull
@NotNull String path)
char value at the given path.
If the value exists at the given path but is not a char, this
will return