Interface ConfigureSection
-
- All Known Implementing Classes:
ConfigureSource
public interface ConfigureSection
Represents a section of a configuration.- Since:
- 4.0.0
- Author:
- Carm
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @NotNull @UnmodifiableView java.util.Map<java.lang.String,java.lang.Object>
asMap()
Get this section as a map.default java.lang.String
childPath(java.lang.String path)
default @NotNull ConfigureSection
computeSection(@NotNull java.lang.String path)
Get or create a section at the given path.default @NotNull ConfigureSection
computeSection(@NotNull java.lang.String path, @NotNull java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> data)
Get or create a section at the given path.default @NotNull ConfigureSection
computeSection(@NotNull java.lang.String path, @NotNull java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> data)
Get or create a section at the given path.default @NotNull ConfigureSection
computeSection(@NotNull java.lang.String path, @NotNull java.util.Map<?,?> data)
Get or create a section at the given path.default boolean
contains(@NotNull java.lang.String path)
Check if the given path is present.default boolean
containsValue(@NotNull java.lang.String path)
Check if the value of given path is present.default @NotNull ConfigureSection
createSection(@NotNull java.lang.String path)
Creates a new emptyConfigureSection
.default @NotNull ConfigureSection
createSection(@NotNull java.lang.String path, @NotNull java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> data)
Creates a newConfigureSection
with specified values.default @NotNull ConfigureSection
createSection(@NotNull java.lang.String path, @NotNull java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> data)
Creates a newConfigureSection
with specified values.@NotNull ConfigureSection
createSection(@NotNull java.lang.String path, @NotNull java.util.Map<?,?> data)
Creates a newConfigureSection
with specified values.default void
forEach(@NotNull java.util.function.BiConsumer<java.lang.String,java.lang.Object> action)
Iterates over all key-values in this section (include child sections)default @NotNull java.lang.String
fullPath()
Get the full path of this section.@Nullable java.lang.Object
get(@NotNull java.lang.String path)
Get the origin value of the path.default <T> T
get(@NotNull java.lang.String path, @NotNull DataFunction<@Nullable java.lang.Object,T> parser)
Get the value of the path using a parser function, if the path does not exist, return NULL.default <T> T
get(@NotNull java.lang.String path, @NotNull java.lang.Class<T> type)
Get the value of the path for specific type, if the path does not exist, return null.default <T> T
get(@NotNull java.lang.String path, T defaultValue, @NotNull DataFunction<java.lang.Object,T> parser)
Get the value of the path using a parser function, if the path does not exist, return the default value.default <T> T
get(@NotNull java.lang.String path, T defaults, @NotNull java.lang.Class<T> clazz)
Get the value of the path for specific type, if the path does not exist, return the default value.default boolean
getBoolean(@NotNull java.lang.String path)
Get the value as aBoolean
from the specified path.default @Nullable java.lang.Boolean
getBoolean(@NotNull java.lang.String path, @Nullable java.lang.Boolean def)
Get the value as aBoolean
from the specified path.default @Nullable java.lang.Byte
getByte(@NotNull java.lang.String path)
Get the value as aByte
from the specified path.default @Nullable java.lang.Byte
getByte(@NotNull java.lang.String path, @Nullable java.lang.Byte def)
Get the value as aByte
from the specified path.default @NotNull java.util.List<java.lang.Byte>
getByteList(@NotNull java.lang.String path)
Get a list of bytes from the sectiondefault @Nullable java.lang.Character
getChar(@NotNull java.lang.String path)
Get the value as aCharacter
from the specified path.default @Nullable java.lang.Character
getChar(@NotNull java.lang.String path, @Nullable java.lang.Character def)
Get the value as aCharacter
from the specified path.default @NotNull java.util.List<java.lang.Character>
getCharList(@NotNull java.lang.String path)
Get a list of char from the sectiondefault <T,C extends java.util.Collection<T>>
CgetCollection(@NotNull java.lang.String path, @NotNull java.util.function.Supplier<C> constructor, @NotNull DataFunction<java.lang.Object,T> parser)
Get the specific type of collection from the section.default @Nullable java.lang.Double
getDouble(@NotNull java.lang.String path)
Get the value as aDouble
from the specified path.default @Nullable java.lang.Double
getDouble(@NotNull java.lang.String path, @Nullable java.lang.Double def)
Get the value as aDouble
from the specified path.default @NotNull java.util.List<java.lang.Double>
getDoubleList(@NotNull java.lang.String path)
Get a list of double from the sectiondefault @Nullable java.lang.Float
getFloat(@NotNull java.lang.String path)
Get the value as aFloat
from the specified path.default @Nullable java.lang.Float
getFloat(@NotNull java.lang.String path, @Nullable java.lang.Float def)
Get the value as aFloat
from the specified path.default @NotNull java.util.List<java.lang.Float>
getFloatList(@NotNull java.lang.String path)
Get a list of floats from the sectiondefault @Nullable java.lang.Integer
getInt(@NotNull java.lang.String path)
Get the value as aInteger
from the specified path.default @Nullable java.lang.Integer
getInt(@NotNull java.lang.String path, @Nullable java.lang.Integer def)
Get the value as aInteger
from the specified path.default @NotNull java.util.List<java.lang.Integer>
getIntegerList(@NotNull java.lang.String path)
Get a list of integer from the sectiondefault @NotNull @UnmodifiableView java.util.Set<java.lang.String>
getKeys(boolean deep)
Gets a set containing all keys in this section.default @Nullable java.util.List<?>
getList(@NotNull java.lang.String path)
Get the value as aList
from the specified path.default <V> @NotNull java.util.List<V>
getList(@NotNull java.lang.String path, @NotNull DataFunction<java.lang.Object,V> parser)
Get a list of values from the sectiondefault @Nullable java.lang.Long
getLong(@NotNull java.lang.String path)
Get the value as aLong
from the specified path.default @Nullable java.lang.Long
getLong(@NotNull java.lang.String path, @Nullable java.lang.Long def)
Get the value as aLong
from the specified path.default @NotNull java.util.List<java.lang.Long>
getLongList(@NotNull java.lang.String path)
Get a list of long from the sectiondefault @Nullable ConfigureSection
getSection(@NotNull java.lang.String path)
Get the value as aConfigureSection
from the specified path.default @Nullable java.lang.Short
getShort(@NotNull java.lang.String path)
Get the value as aShort
from the specified path.default @Nullable java.lang.Short
getShort(@NotNull java.lang.String path, @Nullable java.lang.Short def)
Get the value as aShort
from the specified path.default @Nullable java.lang.String
getString(@NotNull java.lang.String path)
Get the value as aString
from the specified path.default @Nullable java.lang.String
getString(@NotNull java.lang.String path, @Nullable java.lang.String def)
Get the value as aString
from the specified path.default @NotNull java.util.List<java.lang.String>
getStringList(@NotNull java.lang.String path)
Get a list of strings from the section@NotNull @UnmodifiableView java.util.Map<java.lang.String,java.lang.Object>
getValues(boolean deep)
Gets a set containing all values in this section.default boolean
isBoolean(@NotNull java.lang.String path)
Predicate the value of given path is aBoolean
.default @Nullable java.lang.Boolean
isByte(@NotNull java.lang.String path)
Predicate the value of given path is aByte
.default boolean
isChar(@NotNull java.lang.String path)
Predicate the value of given path is aCharacter
.default boolean
isDouble(@NotNull java.lang.String path)
Predicate the value of given path is aDouble
.default boolean
isEmpty()
Gets if this section is empty.default boolean
isFloat(@NotNull java.lang.String path)
Predicate the value of given path is aFloat
.default boolean
isInt(@NotNull java.lang.String path)
Predicate the value of given path is aInteger
.default boolean
isList(@NotNull java.lang.String path)
Predicate the value of given path is aList
.default boolean
isLong(@NotNull java.lang.String path)
Predicate the value of given path is aLong
.Fdefault boolean
isRoot()
Gets if this section is a root section.default boolean
isSection(@NotNull java.lang.String path)
Predicate the value of given path is aConfigureSection
.default boolean
isShort(@NotNull java.lang.String path)
Predicate the value of given path is aShort
.default boolean
isString(@NotNull java.lang.String path)
Predicate the value of given path is aString
.default <T> boolean
isType(@NotNull java.lang.String path, @NotNull java.lang.Class<T> typeClass)
Predicate the value of given path is specific type.default @NotNull @UnmodifiableView java.util.Set<java.lang.String>
keys()
Gets a set containing all primary keys in this section.@Nullable ConfigureSection
parent()
Gets the parent section of this section.static <T,C extends java.util.Collection<T>>
CparseCollection(@Nullable java.util.List<?> data, @NotNull java.util.function.Supplier<C> constructor, @NotNull DataFunction<java.lang.Object,T> parser)
@NotNull java.lang.String
path()
Get the current section's path fromparent()
of this section.default char
pathSeparator()
Get the path separator for the section.void
remove(@NotNull java.lang.String path)
Removes the value at the given path.void
set(@NotNull java.lang.String path, @Nullable java.lang.Object value)
Sets the value at the given path.default int
size(boolean deep)
Gets the number of keys in this section.default java.util.stream.Stream<java.util.Map.Entry<java.lang.String,java.lang.Object>>
stream()
Create a stream of all values in this section.default @NotNull java.util.stream.Stream<?>
stream(@NotNull java.lang.String path)
Get the specific type of steam from the section.default <T> @NotNull java.util.stream.Stream<T>
stream(@NotNull java.lang.String path, @NotNull java.util.function.Function<java.lang.Object,T> parser)
Get the specific type of steam from the section.default @NotNull @UnmodifiableView java.util.Map<java.lang.String,java.lang.Object>
values()
Gets a set containing all key-values in this section.
-
-
-
Method Detail
-
parent
@Contract(pure=true) @Nullable @Nullable ConfigureSection parent()
Gets the parent section of this section.For root sections, this will return null.
- Returns:
- Parent section, or null if this is a root section.
-
path
@NotNull @NotNull java.lang.String path()
Get the current section's path fromparent()
of this section.- Returns:
- The current path of this section, if
isRoot()
, return empty string.
-
fullPath
@NotNull default @NotNull java.lang.String fullPath()
Get the full path of this section.- Returns:
- The full path of this section, if
isRoot()
, return empty string.
-
pathSeparator
default char pathSeparator()
Get the path separator for the section.- Returns:
- The path separator
-
isRoot
@Contract(pure=true) default boolean isRoot()
Gets if this section is a root section.- Returns:
- True if this section is a root section, false otherwise.
-
isEmpty
default boolean isEmpty()
Gets if this section is empty.- Returns:
- True if this section is empty, false otherwise.
-
size
default int size(boolean deep)
Gets the number of keys in this section.- Returns:
- Number of keys in this section.
-
getKeys
@NotNull default @NotNull @UnmodifiableView java.util.Set<java.lang.String> getKeys(boolean deep)
Gets a set containing all keys in this section.If deep is set to true, then this will contain all the keys within any child
ConfigureSection
s (and their children paths).If deep is set to false, then this will contain only the keys of any direct children, and not their own children.
- Parameters:
deep
- Whether to get a deep list.- Returns:
- Set of keys contained within this Section.
-
keys
@NotNull default @NotNull @UnmodifiableView java.util.Set<java.lang.String> keys()
Gets a set containing all primary keys in this section.- Returns:
- Set of keys contained within this Section.
-
getValues
@NotNull @NotNull @UnmodifiableView java.util.Map<java.lang.String,java.lang.Object> getValues(boolean deep)
Gets a set containing all values in this section.If deep is set to true, then this will contain all the keys within any child
ConfigureSection
s (and their children paths).If deep is set to false, then this will contain only the keys of any direct children, and not their own children.
- Parameters:
deep
- Whether to get a deep list.- Returns:
- Map of data values contained within this Section.
-
values
@NotNull default @NotNull @UnmodifiableView java.util.Map<java.lang.String,java.lang.Object> values()
Gets a set containing all key-values in this section.- Returns:
- Map of data values contained within this Section.
- See Also:
getValues(boolean)
-
asMap
@NotNull @NotNull @UnmodifiableView java.util.Map<java.lang.String,java.lang.Object> asMap()
Get this section as a map.In this map, child
ConfigureSection
s will also be represented asMap
s.- Returns:
- Map of data values contained within this Section.
-
stream
default java.util.stream.Stream<java.util.Map.Entry<java.lang.String,java.lang.Object>> stream()
Create a stream of all values in this section.- Returns:
- Stream of all values in this section.
-
forEach
default void forEach(@NotNull @NotNull java.util.function.BiConsumer<java.lang.String,java.lang.Object> action)
Iterates over all key-values in this section (include child sections)- Parameters:
action
- The action to apply to each key.
-
set
void set(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Object value)
Sets the value at the given path.Null values will be kept, if you want to remove a value use
remove(String)
Path separator depends on holder'sStandardOptions.PATH_SEPARATOR
- Parameters:
path
- The path to set the value at.value
- The value to set.
-
remove
void remove(@NotNull @NotNull java.lang.String path)
Removes the value at the given path.Path separator depends on holder's
StandardOptions.PATH_SEPARATOR
- Parameters:
path
- The path to remove the value at.
-
contains
default boolean contains(@NotNull @NotNull java.lang.String path)
Check if the given path is present.Path separator depends on holder's
StandardOptions.PATH_SEPARATOR
- Parameters:
path
- The path to check.- Returns:
- True if the value is present, false otherwise.
-
containsValue
default boolean containsValue(@NotNull @NotNull java.lang.String path)
Check if the value of given path is present.Path separator depends on holder's
StandardOptions.PATH_SEPARATOR
- Parameters:
path
- The path to check.- Returns:
- True if the value is present, false otherwise.
-
isType
default <T> boolean isType(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.lang.Class<T> typeClass)
Predicate the value of given path is specific type.- Type Parameters:
T
- The type to check.- Parameters:
path
- The path to check.typeClass
- The type's class- Returns:
- True if the value is present and is the correct type, false otherwise.
-
isList
default boolean isList(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aList
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a list, false otherwise.
-
getList
@Nullable default @Nullable java.util.List<?> getList(@NotNull @NotNull java.lang.String path)
Get the value as aList
from the specified path.- Parameters:
path
- The path to get theList
.- Returns:
- The list if the path exists and is a list, otherwise null.
-
isSection
default boolean isSection(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aConfigureSection
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a section, false otherwise.
-
getSection
@Nullable default @Nullable ConfigureSection getSection(@NotNull @NotNull java.lang.String path)
Get the value as aConfigureSection
from the specified path.- Parameters:
path
- The path to get the section.- Returns:
- The section if the path exists and is a section, otherwise null.
-
createSection
@NotNull @NotNull ConfigureSection createSection(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.util.Map<?,?> data)
Creates a newConfigureSection
with specified values.The
parent()
of the new section will be this section.This section will not be saved until
set(String, Object)
is called.If you want to create and use a section and set it to this section, use
computeSection(String)
.- Parameters:
data
- The data to be used to create section.- Returns:
- Newly created section
-
createSection
@NotNull default @NotNull ConfigureSection createSection(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> data)
Creates a newConfigureSection
with specified values.The
parent()
of the new section will be this section.- Parameters:
data
- The data to be used to create section.- Returns:
- Newly created section
-
createSection
@NotNull default @NotNull ConfigureSection createSection(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> data)
Creates a newConfigureSection
with specified values.The
parent()
of the new section will be this section.- Parameters:
data
- The data to be used to create section.- Returns:
- Newly created section
-
createSection
@NotNull default @NotNull ConfigureSection createSection(@NotNull @NotNull java.lang.String path)
Creates a new emptyConfigureSection
.The
parent()
of the new section will be this section.- Returns:
- Newly created section
-
computeSection
@NotNull default @NotNull ConfigureSection computeSection(@NotNull @NotNull java.lang.String path)
Get or create a section at the given path.Any value previously set at this path will be replaced if it is not a section or will be returned if it is an exists
ConfigureSection
.- Parameters:
path
- The path to get the section from.- Returns:
- The section at the path, or a new section if it does not exist.
- See Also:
createSection(String, Map)
-
computeSection
@NotNull default @NotNull ConfigureSection computeSection(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.util.Map<?,?> data)
Get or create a section at the given path.Any value previously set at this path will be replaced if it is not a section or will be returned if it is an exists
ConfigureSection
.- Parameters:
path
- The path to get the section from.- Returns:
- The section at the path, or a new section if it does not exist.
- See Also:
createSection(String, Map)
-
computeSection
@NotNull default @NotNull ConfigureSection computeSection(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> data)
Get or create a section at the given path.Any value previously set at this path will be replaced if it is not a section or will be returned if it is an exists
ConfigureSection
.- Parameters:
path
- The path to get the section from.- Returns:
- The section at the path, or a new section if it does not exist.
- See Also:
createSection(String, Map)
-
computeSection
@NotNull default @NotNull ConfigureSection computeSection(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> data)
Get or create a section at the given path.Any value previously set at this path will be replaced if it is not a section or will be returned if it is an exists
ConfigureSection
.- Parameters:
path
- The path to get the section from.- Returns:
- The section at the path, or a new section if it does not exist.
- See Also:
createSection(String, Map)
-
get
@Nullable @Nullable java.lang.Object get(@NotNull @NotNull java.lang.String path)
Get the origin value of the path.- Parameters:
path
- The path to get the value from.- Returns:
- The value at the path, or null if not found.
-
get
@Nullable default <T> T get(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.lang.Class<T> type)
Get the value of the path for specific type, if the path does not exist, return null.- Type Parameters:
T
- The type of the value- Parameters:
path
- The path to get the value from.type
- The type class of the value- Returns:
- The value at the path, or the default value if not found.
-
get
@Nullable default <T> T get(@NotNull @NotNull java.lang.String path, @NotNull @NotNull DataFunction<@Nullable java.lang.Object,T> parser)
Get the value of the path using a parser function, if the path does not exist, return NULL.- Type Parameters:
T
- The type of the value- Parameters:
path
- The path to get the value from.parser
- The function to parse the value- Returns:
- The value at the path, or null if not found.
-
get
@Contract("_,!null,_->!null") @Nullable default <T> T get(@NotNull @NotNull java.lang.String path, @Nullable T defaults, @NotNull @NotNull java.lang.Class<T> clazz)
Get the value of the path for specific type, if the path does not exist, return the default value.- Type Parameters:
T
- The type of the value- Parameters:
path
- The path to get the value from.defaults
- The default value to return if the path does not exist.clazz
- The type class of the value- Returns:
- The value at the path, or the default value if not found.
-
get
@Contract("_,!null,_->!null") @Nullable default <T> T get(@NotNull @NotNull java.lang.String path, @Nullable T defaultValue, @NotNull @NotNull DataFunction<java.lang.Object,T> parser)
Get the value of the path using a parser function, if the path does not exist, return the default value.- Type Parameters:
T
- The type of the value- Parameters:
path
- The path to get the value from.defaultValue
- The default value to return if the path does not exist.parser
- The function to parse the value- Returns:
- The value at the path, or the default value if not found.
-
isBoolean
default boolean isBoolean(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aBoolean
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a boolean, false otherwise.
-
getBoolean
default boolean getBoolean(@NotNull @NotNull java.lang.String path)
Get the value as aBoolean
from the specified path.- Parameters:
path
- The path to get the boolean.- Returns:
- The boolean if the path exists and is a boolean, otherwise false.
-
getBoolean
@Contract("_, !null -> !null") @Nullable default @Nullable java.lang.Boolean getBoolean(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Boolean def)
Get the value as aBoolean
from the specified path.- Parameters:
path
- The path to get the boolean.def
- The default value to return if the path does not exist.- Returns:
- The boolean if the path exists and is a boolean, otherwise the default value.
-
isByte
@Nullable default @Nullable java.lang.Boolean isByte(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aByte
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a byte, false otherwise.
-
getByte
@Nullable default @Nullable java.lang.Byte getByte(@NotNull @NotNull java.lang.String path)
Get the value as aByte
from the specified path.- Parameters:
path
- The path to get the byte.- Returns:
- The byte if the path exists and is a byte, otherwise 0.
-
getByte
@Contract("_, !null -> !null") @Nullable default @Nullable java.lang.Byte getByte(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Byte def)
Get the value as aByte
from the specified path.- Parameters:
path
- The path to get the byte.def
- The default value to return if the path does not exist.- Returns:
- The byte if the path exists and is a byte, otherwise the default value.
-
isShort
default boolean isShort(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aShort
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a short, false otherwise.
-
getShort
@Nullable default @Nullable java.lang.Short getShort(@NotNull @NotNull java.lang.String path)
Get the value as aShort
from the specified path.- Parameters:
path
- The path to get the short.- Returns:
- The short if the path exists and is a short, otherwise 0.
-
getShort
@Contract("_, !null -> !null") @Nullable default @Nullable java.lang.Short getShort(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Short def)
Get the value as aShort
from the specified path.- Parameters:
path
- The path to get the short.def
- The default value to return if the path does not exist.- Returns:
- The short if the path exists and is a short, otherwise the default value.
-
isInt
default boolean isInt(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aInteger
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is an int, false otherwise.
-
getInt
@Nullable default @Nullable java.lang.Integer getInt(@NotNull @NotNull java.lang.String path)
Get the value as aInteger
from the specified path.- Parameters:
path
- The path to get the int.- Returns:
- The int if the path exists and is an int, otherwise 0.
-
getInt
@Contract("_, !null -> !null") @Nullable default @Nullable java.lang.Integer getInt(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Integer def)
Get the value as aInteger
from the specified path.- Parameters:
path
- The path to get the int.def
- The default value to return if the path does not exist.- Returns:
- The int if the path exists and is an int, otherwise the default value.
-
isLong
default boolean isLong(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aLong
.F- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a long, false otherwise.
-
getLong
@Nullable default @Nullable java.lang.Long getLong(@NotNull @NotNull java.lang.String path)
Get the value as aLong
from the specified path.- Parameters:
path
- The path to get the long.- Returns:
- The long if the path exists and is a long, otherwise 0.
-
getLong
@Contract("_, !null -> !null") @Nullable default @Nullable java.lang.Long getLong(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Long def)
Get the value as aLong
from the specified path.- Parameters:
path
- The path to get the long.def
- The default value to return if the path does not exist.- Returns:
- The long if the path exists and is a long, otherwise the default value.
-
isFloat
default boolean isFloat(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aFloat
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a float, false otherwise.
-
getFloat
@Nullable default @Nullable java.lang.Float getFloat(@NotNull @NotNull java.lang.String path)
Get the value as aFloat
from the specified path.- Parameters:
path
- The path to get the float.- Returns:
- The float if the path exists and is a float, otherwise 0.
-
getFloat
@Contract("_, !null -> !null") @Nullable default @Nullable java.lang.Float getFloat(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Float def)
Get the value as aFloat
from the specified path.- Parameters:
path
- The path to get the float.def
- The default value to return if the path does not exist.- Returns:
- The float if the path exists and is a float, otherwise the default value.
-
isDouble
default boolean isDouble(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aDouble
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a double, false otherwise.
-
getDouble
@Nullable default @Nullable java.lang.Double getDouble(@NotNull @NotNull java.lang.String path)
Get the value as aDouble
from the specified path.- Parameters:
path
- The path to get the double.- Returns:
- The double if the path exists and is a double, otherwise 0.
-
getDouble
@Contract("_, !null -> !null") @Nullable default @Nullable java.lang.Double getDouble(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Double def)
Get the value as aDouble
from the specified path.- Parameters:
path
- The path to get the double.def
- The default value to return if the path does not exist.- Returns:
- The double if the path exists and is a double, otherwise the default value.
-
isChar
default boolean isChar(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aCharacter
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a char, false otherwise.
-
getChar
@Nullable default @Nullable java.lang.Character getChar(@NotNull @NotNull java.lang.String path)
Get the value as aCharacter
from the specified path.- Parameters:
path
- The path to get the char.- Returns:
- The char if the path exists and is a char, otherwise null.
-
getChar
@Contract("_, !null -> !null") @Nullable default @Nullable java.lang.Character getChar(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Character def)
Get the value as aCharacter
from the specified path.- Parameters:
path
- The path to get the char.def
- The default value to return if the path does not exist.- Returns:
- The char if the path exists and is a char, otherwise the default value.
-
isString
default boolean isString(@NotNull @NotNull java.lang.String path)
Predicate the value of given path is aString
.- Parameters:
path
- The path to check.- Returns:
- True if the value is present and is a string, false otherwise.
-
getString
@Nullable default @Nullable java.lang.String getString(@NotNull @NotNull java.lang.String path)
Get the value as aString
from the specified path.- Parameters:
path
- The path to get the string.- Returns:
- The string if the path exists and is a string, otherwise null.
-
getString
@Contract("_, !null -> !null") @Nullable default @Nullable java.lang.String getString(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.String def)
Get the value as aString
from the specified path.- Parameters:
path
- The path to get the string.def
- The default value to return if the path does not exist.- Returns:
- The string if the path exists and is a string, otherwise the default value.
-
getList
@NotNull default <V> @NotNull java.util.List<V> getList(@NotNull @NotNull java.lang.String path, @NotNull @NotNull DataFunction<java.lang.Object,V> parser)
Get a list of values from the sectionIf the path does not exist, an empty list will be returned
Any changes please useset(String, Object)
after changes- Type Parameters:
V
- The type of the values- Parameters:
path
- The path to get the list fromparser
- The function to parse the values- Returns:
- The list of values
-
getStringList
@NotNull default @NotNull java.util.List<java.lang.String> getStringList(@NotNull @NotNull java.lang.String path)
Get a list of strings from the sectionLimitations see
getList(String, DataFunction)
- Parameters:
path
- The path to get the list from- Returns:
- The list of strings
-
getIntegerList
@NotNull default @NotNull java.util.List<java.lang.Integer> getIntegerList(@NotNull @NotNull java.lang.String path)
Get a list of integer from the sectionLimitations see
getList(String, DataFunction)
- Parameters:
path
- The path to get the list from- Returns:
- The list of int values
-
getLongList
@NotNull default @NotNull java.util.List<java.lang.Long> getLongList(@NotNull @NotNull java.lang.String path)
Get a list of long from the sectionLimitations see
getList(String, DataFunction)
- Parameters:
path
- The path to get the list from- Returns:
- The list of long values
-
getDoubleList
@NotNull default @NotNull java.util.List<java.lang.Double> getDoubleList(@NotNull @NotNull java.lang.String path)
Get a list of double from the sectionLimitations see
getList(String, DataFunction)
- Parameters:
path
- The path to get the list from- Returns:
- The list of doubles
-
getFloatList
@NotNull default @NotNull java.util.List<java.lang.Float> getFloatList(@NotNull @NotNull java.lang.String path)
Get a list of floats from the sectionLimitations see
getList(String, DataFunction)
- Parameters:
path
- The path to get the list from- Returns:
- The list of floats
-
getByteList
@NotNull default @NotNull java.util.List<java.lang.Byte> getByteList(@NotNull @NotNull java.lang.String path)
Get a list of bytes from the sectionLimitations see
getList(String, DataFunction)
- Parameters:
path
- The path to get the list from- Returns:
- The list of bytes
-
getCharList
@NotNull default @NotNull java.util.List<java.lang.Character> getCharList(@NotNull @NotNull java.lang.String path)
Get a list of char from the sectionLimitations see
getList(String, DataFunction)
- Parameters:
path
- The path to get the list from- Returns:
- The list of char
-
getCollection
@NotNull default <T,C extends java.util.Collection<T>> C getCollection(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.util.function.Supplier<C> constructor, @NotNull @NotNull DataFunction<java.lang.Object,T> parser)
Get the specific type of collection from the section.- Type Parameters:
T
- The type of the valuesC
- The type of the collection- Parameters:
path
- The path to get the collection fromconstructor
- The constructor of the collectionparser
- The function to parse the values- Returns:
- The collection of values
-
stream
@NotNull default @NotNull java.util.stream.Stream<?> stream(@NotNull @NotNull java.lang.String path)
Get the specific type of steam from the section.- Parameters:
path
- The path to get the stream from- Returns:
- The stream of values
-
stream
@NotNull default <T> @NotNull java.util.stream.Stream<T> stream(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.util.function.Function<java.lang.Object,T> parser)
Get the specific type of steam from the section.- Type Parameters:
T
- The type of the values- Parameters:
path
- The path to get the stream fromparser
- The function to parse the values- Returns:
- The stream of values
-
childPath
default java.lang.String childPath(java.lang.String path)
-
parseCollection
@NotNull static <T,C extends java.util.Collection<T>> C parseCollection(@Nullable @Nullable java.util.List<?> data, @NotNull @NotNull java.util.function.Supplier<C> constructor, @NotNull @NotNull DataFunction<java.lang.Object,T> parser)
-
-