org.apache.commons.configuration
Class HierarchicalConfiguration.NodeVisitor

java.lang.Object
  extended byorg.apache.commons.configuration.HierarchicalConfiguration.NodeVisitor
Direct Known Subclasses:
HierarchicalConfiguration.BuilderVisitor
Enclosing class:
HierarchicalConfiguration

public static class HierarchicalConfiguration.NodeVisitor
extends Object

Definition of a visitor class for traversing a node and all of its children.

This class defines the interface of a visitor for Node objects and provides a default implementation. The method visit() of Node implements a generic iteration algorithm based on the Visitor pattern. By providing different implementations of visitors it is possible to collect different data during the iteration process.


Constructor Summary
HierarchicalConfiguration.NodeVisitor()
           
 
Method Summary
 boolean terminate()
          Returns a flag that indicates if iteration should be stopped.
 void visitAfterChildren(HierarchicalConfiguration.Node node, ConfigurationKey key)
          Visits the specified node after its children have been processed.
 void visitBeforeChildren(HierarchicalConfiguration.Node node, ConfigurationKey key)
          Visits the specified node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HierarchicalConfiguration.NodeVisitor

public HierarchicalConfiguration.NodeVisitor()
Method Detail

visitBeforeChildren

public void visitBeforeChildren(HierarchicalConfiguration.Node node,
                                ConfigurationKey key)
Visits the specified node. This method is called during iteration for each node before its children have been visited.

Parameters:
node - the actual node
key - the key of this node (may be null )

visitAfterChildren

public void visitAfterChildren(HierarchicalConfiguration.Node node,
                               ConfigurationKey key)
Visits the specified node after its children have been processed. This gives a visitor the opportunity of collecting additional data after the child nodes have been visited.

Parameters:
node - the node to be visited
key - the key of this node (may be null )

terminate

public boolean terminate()
Returns a flag that indicates if iteration should be stopped. This method is called after each visited node. It can be useful for visitors that search a specific node. If this node is found, the whole process can be stopped. This base implementation always returns false .

Returns:
a flag if iteration should be stopped


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