Package org.apache.commons.configuration
Class HierarchicalConfiguration.Node
java.lang.Object
org.apache.commons.configuration.tree.DefaultConfigurationNode
org.apache.commons.configuration.HierarchicalConfiguration.Node
- All Implemented Interfaces:
Serializable
,Cloneable
,ConfigurationNode
- Direct Known Subclasses:
XMLPropertyListConfiguration.PListNode
- Enclosing class:
HierarchicalConfiguration
public static class HierarchicalConfiguration.Node
extends DefaultConfigurationNode
implements Serializable
A data class for storing (hierarchical) property information. A property
can have a value and an arbitrary number of child properties. From
version 1.3 on this class is only a thin wrapper over the
DefaultconfigurationNode
class that exists mainly for the purpose of backwards compatibility.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.configuration.tree.DefaultConfigurationNode
DefaultConfigurationNode.SubNodes
-
Constructor Summary
ConstructorsConstructorDescriptionNode()
Creates a new instance ofNode
.Creates a new instance ofNode
and sets the name.Creates a new instance ofNode
and sets the name and the value.Node
(ConfigurationNode src) Creates a new instance ofNode
based on the given source node. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given node to the children of this node.Returns the parent of this node.boolean
Returns a flag whether this node has child elements.boolean
Removes all children with the given name.boolean
Removes the specified child from this node.void
Sets the parent of this node.void
visit
(HierarchicalConfiguration.NodeVisitor visitor, ConfigurationKey key) A generic method for traversing this node and all of its children.Methods inherited from class org.apache.commons.configuration.tree.DefaultConfigurationNode
addAttribute, addChild, checkState, clone, createSubNodes, getAttribute, getAttributeCount, getAttributeCount, getAttributes, getAttributes, getChild, getChildren, getChildren, getChildrenCount, getChildrenCount, getName, getParentNode, getReference, getValue, isAttribute, isDefined, removeAttribute, removeAttribute, removeAttributes, removeChild, removeChild, removeChildren, removeReference, setAttribute, setName, setParentNode, setReference, setValue, visit
-
Constructor Details
-
Node
public Node()Creates a new instance ofNode
. -
Node
Creates a new instance ofNode
and sets the name.- Parameters:
name
- the node's name
-
Node
Creates a new instance ofNode
and sets the name and the value.- Parameters:
name
- the node's namevalue
- the value
-
Node
Creates a new instance ofNode
based on the given source node. All properties of the source node, including its children and attributes, will be copied.- Parameters:
src
- the node to be copied
-
-
Method Details
-
getParent
Returns the parent of this node.- Returns:
- this node's parent (can be null)
-
setParent
Sets the parent of this node.- Parameters:
node
- the parent node
-
addChild
Adds the given node to the children of this node.- Parameters:
node
- the child to be added
-
hasChildren
Returns a flag whether this node has child elements.- Returns:
- true if there is a child node, false otherwise
-
remove
Removes the specified child from this node.- Parameters:
child
- the child node to be removed- Returns:
- a flag if the child could be found
-
remove
Removes all children with the given name.- Parameters:
name
- the name of the children to be removed- Returns:
- a flag if children with this name existed
-
visit
A generic method for traversing this node and all of its children. This method sends the passed in visitor to this node and all of its children.- Parameters:
visitor
- the visitorkey
- here a configuration key with the name of the root node of the iteration can be passed; if this key is not null , the full paths to the visited nodes are builded and passed to the visitor'svisit()
methods
-