org.picocontainer.visitors
Class AbstractPicoVisitor

java.lang.Object
  extended by org.picocontainer.visitors.AbstractPicoVisitor
All Implemented Interfaces:
PicoVisitor
Direct Known Subclasses:
TraversalCheckingVisitor

public abstract class AbstractPicoVisitor
extends Object
implements PicoVisitor

Abstract PicoVisitor implementation. A generic traverse method is implemented, that accepts any object with a method named "accept", that takes a PicoVisitor as argument and and invokes it. Additionally it provides the checkTraversal() method, that throws a AbstractPicoVisitor.PicoVisitorTraversalException, if currently no traversal is running.

Author:
Jörg Schaible

Nested Class Summary
static class AbstractPicoVisitor.PicoVisitorTraversalException
          Exception for a PicoVisitor, that is dependent on a defined starting point of the traversal.
 
Field Summary
 
Fields inherited from interface org.picocontainer.PicoVisitor
ABORT_TRAVERSAL, CONTINUE_TRAVERSAL
 
Constructor Summary
AbstractPicoVisitor()
           
 
Method Summary
protected  void checkTraversal()
          Checks the traversal flag, indicating a currently running traversal of the visitor.
 Object traverse(Object node)
          Entry point for the PicoVisitor traversal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.picocontainer.PicoVisitor
visitComponentAdapter, visitComponentFactory, visitContainer, visitParameter
 

Constructor Detail

AbstractPicoVisitor

public AbstractPicoVisitor()
Method Detail

traverse

public Object traverse(Object node)
Description copied from interface: PicoVisitor
Entry point for the PicoVisitor traversal. The given node is the first object, that is asked for acceptance. Only objects of type PicoContainer, ComponentAdapter, or Parameter are valid.

Specified by:
traverse in interface PicoVisitor
Parameters:
node - the start node of the traversal.
Returns:
a visitor-specific value.

checkTraversal

protected void checkTraversal()
Checks the traversal flag, indicating a currently running traversal of the visitor.

Throws:
AbstractPicoVisitor.PicoVisitorTraversalException - if no traversal is active.


Copyright © 2003-2010 Codehaus. All Rights Reserved.