public abstract class DynamicVisitor
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected class |
DynamicVisitor.MethodNodeHandler
A handler use reflection to invoke given method for visiting
|
static interface |
DynamicVisitor.NodeHandler
The handler
|
Modifier and Type | Field and Description |
---|---|
private InheritableValueMap |
_handlers
contains the handlers for different kind of nodese
|
private static java.lang.Class |
OBJECT_ARRAY_CLASS
the object array class
|
Constructor and Description |
---|
DynamicVisitor()
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addMethodNodeHandler(java.lang.Class type,
java.lang.String methodName)
Add MethodNodeHandler using the given method name
throws RuntimeException if the method cannot be found.
|
protected void |
addNodeHandler(java.lang.Class type,
DynamicVisitor.NodeHandler handler)
Add node handler
|
protected abstract void |
initNodeHandlers()
Initialize the node handlers
|
java.lang.Object |
visit(java.lang.Object obj,
java.lang.Object[] args)
The object
|
private static java.lang.Class OBJECT_ARRAY_CLASS
private final InheritableValueMap _handlers
protected abstract void initNodeHandlers()
protected void addNodeHandler(java.lang.Class type, DynamicVisitor.NodeHandler handler)
type
- the typehandler
- the handlerprotected void addMethodNodeHandler(java.lang.Class type, java.lang.String methodName)
type
- the typemethodName
- the method namepublic java.lang.Object visit(java.lang.Object obj, java.lang.Object[] args) throws java.lang.Exception
obj
- the objectargs
- the argumentsjava.lang.Exception