public interface ConfigurationNode
Modifier and Type | Method and Description |
---|---|
ConfigurationNode |
getAppendedNode() |
boolean |
getBoolean()
Gets the value typed using the appropriate type conversion from
Types |
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
|
double |
getDouble()
Gets the value typed using the appropriate type conversion from
Types |
double |
getDouble(double def)
Gets the value typed using the appropriate type conversion from
Types |
float |
getFloat()
Gets the value typed using the appropriate type conversion from
Types |
float |
getFloat(float def)
Gets the value typed using the appropriate type conversion from
Types |
int |
getInt()
Gets the value typed using the appropriate type conversion from
Types |
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(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.
|
long |
getLong()
Gets the value typed using the appropriate type conversion from
Types |
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.
|
String |
getString()
Gets the value typed using the appropriate type conversion from
Types |
String |
getString(String def)
Gets the value typed using the appropriate type conversion from
Types |
Object |
getValue()
Get the current value associated with this node.
|
<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,
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.
|
<T> T |
getValue(TypeToken<T> type)
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.
|
<T> ConfigurationNode |
setValue(TypeToken<T> type,
T value)
Set this node's value to the given value.
|
Object getKey()
Object[] getPath()
ConfigurationNode getParent()
ConfigurationOptions getOptions()
Object getValue()
getValue(Object)
Object getValue(Object def)
def
- The default value to return if this node has no set valuedef
if there is none<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 expected 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(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
String getString()
Types
getValue()
String getString(String def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
float getFloat()
Types
getValue()
float getFloat(float def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
double getDouble()
Types
getValue()
double getDouble(double def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
int getInt()
Types
getValue()
int getInt(int def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
long getLong()
Types
getValue()
long getLong(long def)
Types
def
- The default value if no appropriate value is setdef
if no appropriate value is availablegetValue()
boolean getBoolean()
Types
getValue()
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 set<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 ordef
ObjectMappingException
<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–2015 Leaping Ninja. All rights reserved.