public class IlrVisitor
extends java.lang.Object
To use this visitor, implement a inspect(<the class to visit>) method
for each class to be visited. This visitor implementation is generic, and thus you can write
the visit method only for the classes you're interested in. Also, it supports inheritance by
applying the most specific visit method that is provided.
If there is no implementation of the visit method for the current object's class, the inspect method
will be called. By default it does nothing.
The visited class may implement the IlrVisitable interface. In this case, the
visit follows the path defined by the implementation of the IlrVisitable.accept method
in the visited class. This permits definition of the visit path in the visited classes. Note that you can
easily redefine this behavior by implementing your own callAccept method.
| Constructor and Description |
|---|
IlrVisitor() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
callAccept(IlrVisitable visitable)
This method calls the
accept method on a visited object, which usually means
following a visit path defined by the visited objects. |
void |
inspect(java.lang.Object o)
The default
inspect method is called if a more precise method is not available. |
void |
iterateVisit(java.util.Collection collection)
Method to call to visit each element of a collection.
|
void |
iterateVisit(java.util.Iterator i)
Method to call to visit each element returned by an iterator.
|
void |
visit(java.lang.Object o)
Visit an object.
|
public void iterateVisit(java.util.Collection collection)
collection - A collection. It can be null. In this case, the method does nothing.public void iterateVisit(java.util.Iterator i)
i - An iterator. It can be null. In this case, the method does nothing.public void visit(java.lang.Object o)
inspect method is called based on the class of the parameter.o - The object to visit. If it is null, this method does nothing.protected void callAccept(IlrVisitable visitable)
accept method on a visited object, which usually means
following a visit path defined by the visited objects.
It can be redefined to avoid the path by setting it to do nothing.visitable - public void inspect(java.lang.Object o)
inspect method is called if a more precise method is not available.
It does nothing, but can be redefined.o - © Copyright IBM Corp. 1987, 2017