- public interface Visitable
Interface to be implemented by objects supporting the Visitor
- Rod Johnson
public void acceptVisitor(Visitor v,
- Accept the given visitor.
There are two cases:
- The host (this Visitable object) is a composite element,
with subnodes: The host is responsible for
calling the visitor's enterComposite() method,
calling the acceptVisitor(Visitor) method on any subnodes
implementing this interface, and calling the visitor's
exitComposite() method to end the visit. Note that the Visitor
can prevent the evaluation of subnodes by returning false
in enterComposite(), in which case this object should call
acceptVisitor() on itself instead of child nodes, and ignore
the call to exitComposite().
- The element is a leaf, with no subnodes:
The element must call the Visitor's visit() method on itself
v - Visitor
depth - current depth of traversal, starting at 0
Rod Johnson and Spring contributors 2001-2003.