## org.apache.commons.configuration.tree
Class DefaultConfigurationNode.SubNodes

    java.lang.Object
      org.apache.commons.configuration.tree.DefaultConfigurationNode.SubNodes

Enclosing class:
  DefaultConfigurationNode

    protected static class DefaultConfigurationNode.SubNodes

extends Object

An internally used helper class for managing a collection of sub nodes.

Constructor Summary
`protected` `DefaultConfigurationNode.SubNodes()`

Method Summary
`void` `addNode(ConfigurationNode node)` Adds a new sub node.
`void` `clear()` Removes all sub nodes.
`protected void` `detachNode(ConfigurationNode subNode)` This method is called whenever a sub node is removed from this object.
`protected void` `detachNodes(Collection<? extends ConfigurationNode> subNodes)` Detaches a list of sub nodes.
`ConfigurationNode` `getNode(int index)` Returns the node with the given index.
`List<ConfigurationNode>` `getSubNodes()` Returns a list with all stored sub nodes.
`List<ConfigurationNode>` `getSubNodes(String name)` Returns a list of the sub nodes with the given name.
`boolean` `removeNode(ConfigurationNode node)` Removes a sub node.
`boolean` `removeNodes(String name)` Removes all sub nodes with the given name.
`void` `visit(ConfigurationNodeVisitor visitor)` Let the passed in visitor visit all sub nodes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultConfigurationNode.SubNodes

    protected DefaultConfigurationNode.SubNodes()

Method Detail

### addNode

    public void addNode(ConfigurationNode node)

  Adds a new sub node.

  Parameters:
    `node` - the node to add

### removeNode

    public boolean removeNode(ConfigurationNode node)

  Removes a sub node.

  Parameters:
    `node` - the node to remove
  Returns:
    a flag if the node could be removed

### removeNodes

    public boolean removeNodes(String name)

  Removes all sub nodes with the given name.

  Parameters:
    `name` - the name
  Returns:
    a flag if at least on sub node was removed

### clear

    public void clear()

  Removes all sub nodes.

### getNode

    public ConfigurationNode getNode(int index)

  Returns the node with the given index. If this index cannot be found, an `IndexOutOfBoundException` exception will be thrown.

  Parameters:
    `index` - the index (0-based)
  Returns:
    the sub node at the specified index

### getSubNodes

    public List<ConfigurationNode> getSubNodes()

  Returns a list with all stored sub nodes. The return value is never null.

  Returns:
    a list with the sub nodes

### getSubNodes

    public List<ConfigurationNode> getSubNodes(String name)

  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

    public void visit(ConfigurationNodeVisitor visitor)

  Let the passed in visitor visit all sub nodes.

  Parameters:
    `visitor` - the visitor

### detachNode

    protected void detachNode(ConfigurationNode subNode)

  This method is called whenever a sub node is removed from this object. It ensures that the removed node's parent is reset and its `removeReference()` method gets called.

  Parameters:
    `subNode` - the node to be removed

### detachNodes

    protected void detachNodes(Collection<? extends ConfigurationNode> subNodes)

  Detaches a list of sub nodes. This method calls `detachNode()` for each node contained in the list.

  Parameters:
    `subNodes` - the list with nodes to be detached

Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.