public class DdlConfigNode extends Object implements Comparable<DdlConfigNode>
| Modifier and Type | Method and Description |
|---|---|
DdlConfigNode |
add(String key,
String value)
Adds a descendent value into the tree.
|
void |
addAll(Properties properties)
Adds all of the properties as child properties.
|
DdlConfigNode |
addNode(String relativePath,
DdlConfigNode node)
Grafts the provide config node at the relative path specified by the key.
|
Collection<DdlConfigNode> |
collectDescendents(Collection<DdlConfigNode> collection)
Collects all of the descendences of this node.
|
int |
compareTo(DdlConfigNode o) |
boolean |
equals(Object other) |
DdlConfigNode |
get(String relativePath)
Gets a child node at a path relative to this node.
|
Collection<DdlConfigNode> |
getChildren()
Gets this nodes child nodes.
|
String |
getFullName()
Gets the ful name of the node (including ancenstor levels).
|
String |
getName()
Gets the short name of this node.
|
DdlConfigNode |
getParent()
Gets this node's immediate parent node..
|
DdlConfigNode |
getRequiredChild(String name)
Gets a required child node.
|
String |
getRequiredValue()
Gets the value of this node, ensuring that a value exists.
|
String |
getRequiredValue(String name)
Gets a required value of a child of this node by name.
|
DdlConfigTree |
getRoot()
Gets this node's config tree root.
|
String |
getUnsubstitutedValue()
Returns the value of the node without doing substitutions.
|
String |
getValue()
Gets the value of this node.
|
String |
getValue(String name)
Gets the value of a child if it exists.
|
boolean |
getValue(String name,
boolean defaultValue)
Fetch the value of the given child node as a boolean.
|
short |
getValue(String name,
byte defaultValue)
Fetch the value of the given child node as a byte.
|
char |
getValue(String name,
char defaultValue)
Fetch the value of the given child node as a char.
|
double |
getValue(String name,
double defaultValue)
Fetch the value of the given child node as a float.
|
float |
getValue(String name,
float defaultValue)
Fetch the value of the given child node as a float.
|
int |
getValue(String name,
int defaultValue)
Fetch the value of the given child node as a int.
|
long |
getValue(String name,
long defaultValue)
Fetch the value of the given child node as a long.
|
short |
getValue(String name,
short defaultValue)
Fetch the value of the given child node as a short.
|
String |
getValue(String name,
String defaultValue)
Gets the value of a child if it exists.
|
int |
hashCode() |
void |
merge(DdlConfigNode source,
boolean override)
Merges source values into this node.
|
DdlConfigNode |
remove(String relativePath)
Removes a child (and all of its descendants from the tree.
|
String |
toString() |
public final String getName()
public final String getFullName()
public final String getUnsubstitutedValue()
public final String getValue()
public boolean getValue(String name, boolean defaultValue)
name - the child node name (relative to this node).defaultValue - The default value if the node doesn't exist or is not set.public short getValue(String name, byte defaultValue)
name - the child node name (relative to this node).defaultValue - The default value if the node doesn't exist or is not set.public char getValue(String name, char defaultValue)
name - the child node name (relative to this node).defaultValue - The default value if the node doesn't exist or is not set.public short getValue(String name, short defaultValue)
name - the child node name (relative to this node).defaultValue - The default value if the node doesn't exist or is not set.public int getValue(String name, int defaultValue)
name - the child node name (relative to this node).defaultValue - The default value if the node doesn't exist or is not set.public long getValue(String name, long defaultValue)
name - the child node name (relative to this node).defaultValue - The default value if the node doesn't exist or is not set.public float getValue(String name, float defaultValue)
name - the child node name (relative to this node).defaultValue - The default value if the node doesn't exist or is not set.public double getValue(String name, double defaultValue)
name - the child node name (relative to this node).defaultValue - The default value if the node doesn't exist or is not set.public DdlConfigNode get(String relativePath)
relativePath - The child path relative to this node.public final String getValue(String name)
name - the child node name (relative to this node).public final String getValue(String name, String defaultValue)
name - the child node name (relative to this node).defaultValue - The default value if the node doesn't exist or is not set.public String getRequiredValue()
public String getRequiredValue(String name)
DdlConfigException - if the value cannot be found.public DdlConfigTree getRoot()
public DdlConfigNode getParent()
public Collection<DdlConfigNode> getChildren()
public DdlConfigNode getRequiredChild(String name)
name - The child node name.DdlConfigException - if the property is not found.public void addAll(Properties properties)
properties - The properties to add.public void merge(DdlConfigNode source, boolean override)
source - The source node.override - Whether or not to override existing values with the source values.public DdlConfigNode add(String key, String value)
key - (relative to this DdlConfigNode).value - The value or null if the node doesn't hold a value.public DdlConfigNode remove(String relativePath)
This operation leaves the tree beneath the removed node intact relative to the node removed, but detached from the config tree to which the node formerlly belonged.
relativePath - The path to the node to remove relative to this DdlConfigNode.public DdlConfigNode addNode(String relativePath, DdlConfigNode node)
If the node already has a parent it will be removed from the parent and relocated to the relative path specified by the provided key.
This method will create any intermediate config nodes that do not exist.
relativePath - The path, relative to this DdlConfigNode.node - The node to add.public Collection<DdlConfigNode> collectDescendents(Collection<DdlConfigNode> collection)
collection - The collection to which to add this node's descendents.public int compareTo(DdlConfigNode o)
compareTo in interface Comparable<DdlConfigNode>Copyright © 2019 N5 Technologies, Inc. All Rights Reserved.