org.apache.commons.configuration
Class HierarchicalConfiguration.CloneVisitor

java.lang.Object
  extended byorg.apache.commons.configuration.HierarchicalConfiguration.NodeVisitor
      extended byorg.apache.commons.configuration.HierarchicalConfiguration.CloneVisitor
Enclosing class:
HierarchicalConfiguration

static class HierarchicalConfiguration.CloneVisitor
extends HierarchicalConfiguration.NodeVisitor

A specialized visitor that is able to create a deep copy of a node hierarchy.

Author:
Oliver Heger

Field Summary
private  java.util.Stack copyStack
          A stack with the actual object to be copied.
private  HierarchicalConfiguration.Node result
          Stores the result of the clone process.
 
Constructor Summary
HierarchicalConfiguration.CloneVisitor()
          Creates a new instance of CloneVisitor.
 
Method Summary
 HierarchicalConfiguration.Node getClone()
          Returns the result of the clone process.
 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 and copies the specified node.
 
Methods inherited from class org.apache.commons.configuration.HierarchicalConfiguration.NodeVisitor
terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyStack

private java.util.Stack copyStack
A stack with the actual object to be copied.


result

private HierarchicalConfiguration.Node result
Stores the result of the clone process.

Constructor Detail

HierarchicalConfiguration.CloneVisitor

public HierarchicalConfiguration.CloneVisitor()
Creates a new instance of CloneVisitor.

Method Detail

visitAfterChildren

public void visitAfterChildren(HierarchicalConfiguration.Node node,
                               ConfigurationKey key)
Visits the specified node after its children have been processed.

Overrides:
visitAfterChildren in class HierarchicalConfiguration.NodeVisitor
Parameters:
node - the node
key - the key of this node

visitBeforeChildren

public void visitBeforeChildren(HierarchicalConfiguration.Node node,
                                ConfigurationKey key)
Visits and copies the specified node.

Overrides:
visitBeforeChildren in class HierarchicalConfiguration.NodeVisitor
Parameters:
node - the node
key - the key of this node

getClone

public HierarchicalConfiguration.Node getClone()
Returns the result of the clone process. This is the root node of the cloned node hierarchy.

Returns:
the cloned root node