public interface ClassVisitor
Note: if the visitor maintains state relative to visitBefore(Class)
and other methods
that could be disrupted by visiting member classes (currently just enums), then a stack should be
used to maintain whatever state needs to be remembered. For instance, OperationExtractor
maintains the declaring class type for visited members, and when inner enums are visited the
declaring class needs to be remembered and restored by visitAfter(Class)
.
ReflectionManager
,
OperationExtractor
Modifier and Type | Method and Description |
---|---|
void |
visit(java.lang.Class<?> c,
ReflectionManager reflectionManager)
Perform action on member class.
|
void |
visit(java.lang.reflect.Constructor<?> c)
Perform action on a constructor.
|
void |
visit(java.lang.Enum<?> e)
Perform an action on an enum value.
|
void |
visit(java.lang.reflect.Field f)
Perform an action on a field.
|
void |
visit(java.lang.reflect.Method m)
Perform an action on a method.
|
void |
visitAfter(java.lang.Class<?> c)
Perform an action on a class.
|
void |
visitBefore(java.lang.Class<?> c)
Perform an action on a class.
|
void visit(java.lang.Class<?> c, ReflectionManager reflectionManager)
The ReflectionManager
is needed to allow visitors to initiate recursive visits if
needed.
c
- the member classreflectionManager
- the ReflectionManager
that called this visitorvoid visit(java.lang.reflect.Constructor<?> c)
c
- the constructorvoid visit(java.lang.reflect.Method m)
m
- the methodvoid visit(java.lang.reflect.Field f)
f
- the fieldvoid visit(java.lang.Enum<?> e)
e
- the enum valuevoid visitBefore(java.lang.Class<?> c)
c
- the class to visitvoid visitAfter(java.lang.Class<?> c)
c
- the class to visit