Class DefaultConfigurationNode.SubNodes
java.lang.Object
org.apache.commons.configuration.tree.DefaultConfigurationNode.SubNodes
- Enclosing class:
DefaultConfigurationNode
An internally used helper class for managing a collection of sub nodes.
- Since:
- 1.3
- Version:
- $Id: DefaultConfigurationNode.java 1301991 2012-03-17 20:18:02Z sebb $
- Author:
- Commons Configuration team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNode(ConfigurationNode node) Adds a new sub node.voidclear()Removes all sub nodes.protected voiddetachNode(ConfigurationNode subNode) This method is called whenever a sub node is removed from this object.protected voiddetachNodes(Collection<? extends ConfigurationNode> subNodes) Detaches a list of sub nodes.getNode(int index) Returns the node with the given index.Returns a list with all stored sub nodes.getSubNodes(String name) Returns a list of the sub nodes with the given name.booleanremoveNode(ConfigurationNode node) Removes a sub node.booleanremoveNodes(String name) Removes all sub nodes with the given name.voidvisit(ConfigurationNodeVisitor visitor) Let the passed in visitor visit all sub nodes.
-
Constructor Details
-
SubNodes
protected SubNodes()
-
-
Method Details
-
addNode
-
removeNode
Removes a sub node.- Parameters:
node- the node to remove- Returns:
- a flag if the node could be removed
-
removeNodes
Removes all sub nodes with the given name.- Parameters:
name- the name- Returns:
- a flag if at least on sub node was removed
-
clear
Removes all sub nodes. -
getNode
Returns the node with the given index. If this index cannot be found, anIndexOutOfBoundExceptionexception will be thrown.- Parameters:
index- the index (0-based)- Returns:
- the sub node at the specified index
-
getSubNodes
Returns a list with all stored sub nodes. The return value is never null.- Returns:
- a list with the sub nodes
-
getSubNodes
Returns a list of the sub nodes with the given name. The return value is never null.- Parameters:
name- the name; if null is passed, all sub nodes will be returned- Returns:
- all sub nodes with this name
-
visit
Let the passed in visitor visit all sub nodes.- Parameters:
visitor- the visitor
-
detachNode
This method is called whenever a sub node is removed from this object. It ensures that the removed node's parent is reset and itsremoveReference()method gets called.- Parameters:
subNode- the node to be removed
-
detachNodes
Detaches a list of sub nodes. This method callsdetachNode()for each node contained in the list.- Parameters:
subNodes- the list with nodes to be detached
-