public interface ConfigurationNode
Modifier and Type | Field and Description |
---|---|
static int |
NUMBER_DEF |
Modifier and Type | Method and Description |
---|---|
ConfigurationNode |
getAppendedNode() |
default boolean |
getBoolean()
Gets the value typed using the appropriate type conversion from
Types |
default boolean |
getBoolean(boolean def)
Gets the value typed using the appropriate type conversion from
Types |
List<? extends ConfigurationNode> |
getChildrenList()
Return an immutable copy of the list of children this node is aware of
|
Map<Object,? extends ConfigurationNode> |
getChildrenMap()
Return an immutable copy of the mapping from key to node of every child this node is aware of
|
default double |
getDouble()
Gets the value typed using the appropriate type conversion from
Types |
default double |
getDouble(double def)
Gets the value typed using the appropriate type conversion from
Types |
default float |
getFloat()
Gets the value typed using the appropriate type conversion from
Types |
default float |
getFloat(float def)
Gets the value typed using the appropriate type conversion from
Types |
default int |
getInt()
Gets the value typed using the appropriate type conversion from
Types |
default int |
getInt(int def)
Gets the value typed using the appropriate type conversion from
Types |
Object |
getKey()
The key for this node.
|
<T> List<T> |
getList(Function<Object,T> transformer)
If this node has list values, this function unwraps them and converts them to an appropriate type based on the
provided function.
|
<T> List<T> |
getList(Function<Object,T> transformer,
List<T> def)
If this node has list values, this function unwraps them and converts them to an appropriate type based on the
provided function.
|
<T> List<T> |
getList(Function<Object,T> transformer,
Supplier<List<T>> defSupplier)
If this node has list values, this function unwraps them and converts them to an appropriate type based on the
provided function.
|
default <T> List<T> |
getList(TypeToken<T> type)
If this node has list values, this function unwraps them and converts them to an appropriate type based on the
provided type.
|
<T> List<T> |
getList(TypeToken<T> type,
List<T> def)
If this node has list values, this function unwraps them and converts them to an appropriate type based on the
provided type.
|
<T> List<T> |
getList(TypeToken<T> type,
Supplier<List<T>> defSupplier)
If this node has list values, this function unwraps them and converts them to an appropriate type based on the
provided type.
|
default long |
getLong()
Gets the value typed using the appropriate type conversion from
Types |
default long |
getLong(long def)
Gets the value typed using the appropriate type conversion from
Types |
ConfigurationNode |
getNode(Object... path)
Gets the node at the given (relative) path, possibly traversing multiple levels of nodes
|
ConfigurationOptions |
getOptions()
Return the options that currently apply to this node
|
ConfigurationNode |
getParent()
Returns the current parent for this node.
|
Object[] |
getPath()
The full path from the root to this node.
|
default String |
getString()
Gets the value typed using the appropriate type conversion from
Types |
default String |
getString(String def)
Gets the value typed using the appropriate type conversion from
Types |
default Object |
getValue()
Get the current value associated with this node.
|
default <T> T |
getValue(Function<Object,T> transformer)
Gets the appropriately transformed typed version of this node's value from the provided transformation function
|
<T> T |
getValue(Function<Object,T> transformer,
Supplier<T> defSupplier)
Gets the appropriately transformed typed version of this node's value from the provided transformation function
|
<T> T |
getValue(Function<Object,T> transformer,
T def)
Gets the appropriately transformed typed version of this node's value from the provided transformation function
|
Object |
getValue(Object def)
Get the current value associated with this node.
|
Object |
getValue(Supplier<Object> defSupplier)
Get the current value associated with this node.
|
default <T> T |
getValue(TypeToken<T> type)
Get the current value associated with this node.
|
<T> T |
getValue(TypeToken<T> type,
Supplier<T> defSupplier)
Get the current value associated with this node.
|
<T> T |
getValue(TypeToken<T> type,
T def)
Get the current value associated with this node.
|
boolean |
hasListChildren() |
boolean |
hasMapChildren() |
boolean |
isVirtual()
Whether this node does not currently exist in the configuration structure.
|
ConfigurationNode |
mergeValuesFrom(ConfigurationNode other)
Set all the values from the given node that are not present in this node
to their values in the provided node.
|
boolean |
removeChild(Object key)
Removes a direct child of this node
|
ConfigurationNode |
setValue(Object value)
Set this node's value to the given value.
|
default <T> ConfigurationNode |
setValue(TypeToken<T> type,
T value)
Set this node's value to the given value.
|
static final int NUMBER_DEF
Object getKey()
Object[] getPath()
ConfigurationNode getParent()
ConfigurationOptions getOptions()
default Object getValue()
getValue(Object)
Object getValue(Object def)
def
- The default value to return if this node has no set valuedef
if there is noneObject getValue(Supplier<Object> defSupplier)
defSupplier
- The function that will be called to calculate a default value only if there is no existing
valuedef
if there is nonedefault <T> T getValue(Function<Object,T> transformer)
T
- The expected typetransformer
- The transformation function<T> T getValue(Function<Object,T> transformer, T def)
T
- The expected typetransformer
- The transformation functiondef
- The default value to return if this node has no set value or is not of a convertable typedef
either if no value is present or the value
could not be converted<T> T getValue(Function<Object,T> transformer, Supplier<T> defSupplier)
T
- The expected typetransformer
- The transformation functiondefSupplier
- The function that will be called to calculate a default value only if there is no existing
value of the correct typedef
either if no value is present or the value
could not be converted<T> List<T> getList(Function<Object,T> transformer)
T
- The expected typetransformer
- The transformation function<T> List<T> getList(Function<Object,T> transformer, List<T> def)
T
- The expected typetransformer
- The transformation functiondef
- The default value if no appropriate value is setdef
if no
values could be converted<T> List<T> getList(Function<Object,T> transformer, Supplier<List<T>> defSupplier)
T
- The expected typetransformer
- The transformation functiondefSupplier
- The function that will be called to calculate a default value only if there is no existing
value of the correct typedef
if no
values could be converteddefault <T> List<T> getList(TypeToken<T> type) throws ObjectMappingException
T
- The expected typetype
- The expected typeObjectMappingException
<T> List<T> getList(TypeToken<T> type, List<T> def) throws ObjectMappingException
T
- The expected typetype
- The expected typedef
- The default value if no appropriate value is setdef
if no
values could be convertedObjectMappingException
<T> List<T> getList(TypeToken<T> type, Supplier<List<T>> defSupplier) throws ObjectMappingException
T
- The expected typetype
- The expected typedefSupplier
- The function that will be called to calculate a default value only if there is no existing
value of the correct typedef
if no
values could be convertedObjectMappingException
default String getString()
Types
getValue()
default String getString(String def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
default float getFloat()
Types
getValue()
default float getFloat(float def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
default double getDouble()
Types
getValue()
default double getDouble(double def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
default int getInt()
Types
getValue()
default int getInt(int def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
default long getLong()
Types
getValue()
default long getLong(long def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
default boolean getBoolean()
Types
getValue()
default boolean getBoolean(boolean def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
ConfigurationNode setValue(Object value)
Collection
or a Map
, it will be unwrapped into
the appropriate configuration node structurevalue
- The value to setdefault <T> T getValue(TypeToken<T> type) throws ObjectMappingException
T
- the type to gettype
- The type to deserialize toObjectMappingException
<T> T getValue(TypeToken<T> type, T def) throws ObjectMappingException
T
- the type to gettype
- The type to deserialize todef
- The value to return if no value or value is not of appropriate typedef
ObjectMappingException
<T> T getValue(TypeToken<T> type, Supplier<T> defSupplier) throws ObjectMappingException
T
- the type to gettype
- The type to deserialize todefSupplier
- The function that will be called to calculate a default value only if there is no existing
value of the correct typedef
ObjectMappingException
default <T> ConfigurationNode setValue(TypeToken<T> type, T value) throws ObjectMappingException
Collection
or a Map
, it will be unwrapped into
the appropriate configuration node structure.
This method will also perform serialization using the appropriate TypeSerializer for the given type, or casting if no type serializer is found.T
- The type to serialize totype
- The type to use for serialization type informationvalue
- The value to setObjectMappingException
ConfigurationNode mergeValuesFrom(ConfigurationNode other)
other
- The node to merge values fromboolean hasListChildren()
boolean hasMapChildren()
List<? extends ConfigurationNode> getChildrenList()
Map<Object,? extends ConfigurationNode> getChildrenMap()
boolean removeChild(Object key)
key
- The key of the node to removeConfigurationNode getAppendedNode()
ConfigurationNode getNode(Object... path)
path
- The path to fetch the node atboolean isVirtual()
Copyright © 2014–2017. All rights reserved.