public class SimpleConfigurationNode extends Object implements ConfigurationNode
NUMBER_DEF| Modifier | Constructor and Description |
|---|---|
protected |
SimpleConfigurationNode(Object key,
SimpleConfigurationNode parent,
ConfigurationOptions options) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
attachChild(SimpleConfigurationNode child) |
protected void |
attachIfNecessary() |
protected void |
clear() |
protected SimpleConfigurationNode |
createNode(Object path) |
boolean |
equals(Object o) |
SimpleConfigurationNode |
getAppendedNode() |
protected SimpleConfigurationNode |
getChild(Object key,
boolean attach) |
List<? extends SimpleConfigurationNode> |
getChildrenList()
Return an immutable copy of the list of children this node is aware of
|
Map<Object,? extends SimpleConfigurationNode> |
getChildrenMap()
Return an immutable copy of the mapping from key to node of every child this node is aware of
|
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.
|
<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.
|
SimpleConfigurationNode |
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
|
SimpleConfigurationNode |
getParent()
Returns the current parent for this node.
|
Object[] |
getPath()
The full path from the root to this node.
|
<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.
|
<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.
|
int |
hashCode() |
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
|
static SimpleConfigurationNode |
root() |
static SimpleConfigurationNode |
root(ConfigurationOptions options) |
SimpleConfigurationNode |
setValue(Object newValue)
Set this node's value to the given value.
|
String |
toString() |
protected SimpleConfigurationNode(Object key, SimpleConfigurationNode parent, ConfigurationOptions options)
public static SimpleConfigurationNode root()
public static SimpleConfigurationNode root(ConfigurationOptions options)
public Object getValue(Object def)
ConfigurationNodegetValue in interface ConfigurationNodedef - The default value to return if this node has no set valuedef if there is nonepublic Object getValue(Supplier<Object> defSupplier)
ConfigurationNodegetValue in interface ConfigurationNodedefSupplier - The function that will be called to calculate a default value only if there is no existing
valuedef if there is nonepublic <T> T getValue(Function<Object,T> transformer, T def)
ConfigurationNodegetValue in interface ConfigurationNodeT - 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 convertedpublic <T> T getValue(Function<Object,T> transformer, Supplier<T> defSupplier)
ConfigurationNodegetValue in interface ConfigurationNodeT - 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 convertedpublic <T> List<T> getList(Function<Object,T> transformer)
ConfigurationNodegetList in interface ConfigurationNodeT - The expected typetransformer - The transformation functionpublic <T> List<T> getList(Function<Object,T> transformer, List<T> def)
ConfigurationNodegetList in interface ConfigurationNodeT - The expected typetransformer - The transformation functiondef - The default value if no appropriate value is setdef if no
values could be convertedpublic <T> List<T> getList(Function<Object,T> transformer, Supplier<List<T>> defSupplier)
ConfigurationNodegetList in interface ConfigurationNodeT - 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 convertedpublic <T> List<T> getList(TypeToken<T> type, List<T> def) throws ObjectMappingException
ConfigurationNodegetList in interface ConfigurationNodeT - The expected typetype - The expected typedef - The default value if no appropriate value is setdef if no
values could be convertedObjectMappingExceptionpublic <T> List<T> getList(TypeToken<T> type, Supplier<List<T>> defSupplier) throws ObjectMappingException
ConfigurationNodegetList in interface ConfigurationNodeT - 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 convertedObjectMappingExceptionpublic SimpleConfigurationNode setValue(Object newValue)
ConfigurationNodeCollection or a Map, it will be unwrapped into
the appropriate configuration node structuresetValue in interface ConfigurationNodenewValue - The value to setpublic <T> T getValue(TypeToken<T> type, T def) throws ObjectMappingException
ConfigurationNodegetValue in interface ConfigurationNodeT - the type to gettype - The type to deserialize todef - The value to return if no value or value is not of appropriate typedefObjectMappingExceptionpublic <T> T getValue(TypeToken<T> type, Supplier<T> defSupplier) throws ObjectMappingException
ConfigurationNodegetValue in interface ConfigurationNodeT - 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 typedefObjectMappingExceptionpublic ConfigurationNode mergeValuesFrom(ConfigurationNode other)
ConfigurationNodemergeValuesFrom in interface ConfigurationNodeother - The node to merge values frompublic SimpleConfigurationNode getNode(Object... path)
ConfigurationNodegetNode in interface ConfigurationNodepath - The path to fetch the node atpublic boolean isVirtual()
ConfigurationNodeisVirtual in interface ConfigurationNodepublic boolean hasListChildren()
hasListChildren in interface ConfigurationNodepublic boolean hasMapChildren()
hasMapChildren in interface ConfigurationNodepublic List<? extends SimpleConfigurationNode> getChildrenList()
ConfigurationNodegetChildrenList in interface ConfigurationNodepublic Map<Object,? extends SimpleConfigurationNode> getChildrenMap()
ConfigurationNodegetChildrenMap in interface ConfigurationNodeprotected SimpleConfigurationNode getChild(Object key, boolean attach)
public boolean removeChild(Object key)
ConfigurationNoderemoveChild in interface ConfigurationNodekey - The key of the node to removepublic SimpleConfigurationNode getAppendedNode()
getAppendedNode in interface ConfigurationNodepublic Object getKey()
ConfigurationNodegetKey in interface ConfigurationNodepublic Object[] getPath()
ConfigurationNodegetPath in interface ConfigurationNodepublic SimpleConfigurationNode getParent()
ConfigurationNodegetParent in interface ConfigurationNodepublic ConfigurationOptions getOptions()
ConfigurationNodegetOptions in interface ConfigurationNodeprotected SimpleConfigurationNode createNode(Object path)
protected void attachIfNecessary()
protected void attachChild(SimpleConfigurationNode child)
protected void clear()
Copyright © 2014–2017. All rights reserved.