public abstract class AbstractClassFileHierarchicalVisitor extends java.lang.Object implements NodeHierarchicalVisitor
visitEnter(Node)
and visitLeave(Node)
. The methods that are delegated to, contains parameter arguments for various ClassFile structures.
To use this class, you must extend it and override the methods that contains parameter arguments for the ClassFile structures that you are interested in.
This class has no state and is therefore thread-safe. However, this may not be the case for some arbitrary implementation.
Modifier | Constructor and Description |
---|---|
protected |
AbstractClassFileHierarchicalVisitor()
Constructs a new
AbstractClassFileHierarchicalVisitor instance. |
Modifier and Type | Method and Description |
---|---|
protected boolean |
visitEnter(AttributeInfo attributeInfo)
This method is delegated to when entering a
Node that is an instance of AttributeInfo . |
protected boolean |
visitEnter(CPInfo cPInfo)
|
protected boolean |
visitEnter(FieldInfo fieldInfo)
|
protected boolean |
visitEnter(MethodInfo methodInfo)
This method is delegated to when entering a
Node that is an instance of MethodInfo . |
boolean |
visitEnter(Node node)
Called by a concrete
Node implementation. |
protected boolean |
visitLeave(AttributeInfo attributeInfo)
This method is delegated to when leaving a
Node that is an instance of AttributeInfo . |
protected boolean |
visitLeave(CPInfo cPInfo)
|
protected boolean |
visitLeave(FieldInfo fieldInfo)
|
protected boolean |
visitLeave(MethodInfo methodInfo)
This method is delegated to when leaving a
Node that is an instance of MethodInfo . |
boolean |
visitLeave(Node node)
Called by a concrete
Node implementation. |
protected AbstractClassFileHierarchicalVisitor()
AbstractClassFileHierarchicalVisitor
instance.public final boolean visitEnter(Node node)
Node
implementation.
It should happen soon after its accept(NodeHierarchicalVisitor)
method has been called, with this AbstractClassFileHierarchicalVisitor
as its parameter argument.
If node
is null
, a NullPointerException
may be thrown. But no guarantees can be made.
If node
could not be traversed by this AbstractClassFileHierarchicalVisitor
, a NodeTraversalException
may be thrown. But no guarantees can be made.
To visit node
s child Node
s, return true
, false
otherwise.
visitEnter
in interface NodeHierarchicalVisitor
node
- the Node
to entertrue
if, and only if, node
s child Node
s should be visited, false
otherwiseNodeTraversalException
- thrown if, and only if, node
could not be traversed by this AbstractClassFileHierarchicalVisitor
java.lang.NullPointerException
- thrown if, and only if, node
is null
public final boolean visitLeave(Node node)
Node
implementation.
It should happen just before its accept(NodeHierarchicalVisitor)
method returns. Actually, it should be the result returned by that method.
If node
is null
, a NullPointerException
may be thrown. But no guarantees can be made.
If node
could not be traversed by this AbstractClassFileHierarchicalVisitor
, a NodeTraversalException
may be thrown. But no guarantees can be made.
To visit node
s sibling Node
s, return true
, false
otherwise.
visitLeave
in interface NodeHierarchicalVisitor
node
- the Node
to leavetrue
if, and only if, node
s sibling Node
s should be visited, false
otherwiseNodeTraversalException
- thrown if, and only if, node
could not be traversed by this AbstractClassFileHierarchicalVisitor
java.lang.NullPointerException
- thrown if, and only if, node
is null
protected boolean visitEnter(AttributeInfo attributeInfo)
Node
that is an instance of AttributeInfo
.
By default true
is returned.
If you want to do something with an AttributeInfo
when entering it, you have to override this method.
If overriding, you have to return true
if you want to visit any children, false
otherwise.
attributeInfo
- the Node
to entertrue
if, and only if, you want to visit the Node
s children, false
otherwiseprotected boolean visitEnter(CPInfo cPInfo)
Node
that is an instance of CPInfo
.
By default true
is returned.
If you want to do something with a CPInfo
when entering it, you have to override this method.
If overriding, you have to return true
if you want to visit any children, false
otherwise.
cPInfo
- the Node
to entertrue
if, and only if, you want to visit the Node
s children, false
otherwiseprotected boolean visitEnter(FieldInfo fieldInfo)
Node
that is an instance of FieldInfo
.
By default true
is returned.
If you want to do something with a FieldInfo
when entering it, you have to override this method.
If overriding, you have to return true
if you want to visit any children, false
otherwise.
fieldInfo
- the Node
to entertrue
if, and only if, you want to visit the Node
s children, false
otherwiseprotected boolean visitEnter(MethodInfo methodInfo)
Node
that is an instance of MethodInfo
.
By default true
is returned.
If you want to do something with a MethodInfo
when entering it, you have to override this method.
If overriding, you have to return true
if you want to visit any children, false
otherwise.
methodInfo
- the Node
to entertrue
if, and only if, you want to visit the Node
s children, false
otherwiseprotected boolean visitLeave(AttributeInfo attributeInfo)
Node
that is an instance of AttributeInfo
.
By default true
is returned.
If you want to do something with an AttributeInfo
when leaving it, you have to override this method.
If overriding, you have to return true
if you want to visit any remaining siblings, false
otherwise.
attributeInfo
- the Node
to leavetrue
if, and only if, you want to visit the Node
s remaining siblings, false
otherwiseprotected boolean visitLeave(CPInfo cPInfo)
Node
that is an instance of CPInfo
.
By default true
is returned.
If you want to do something with a CPInfo
when leaving it, you have to override this method.
If overriding, you have to return true
if you want to visit any remaining siblings, false
otherwise.
cPInfo
- the Node
to leavetrue
if, and only if, you want to visit the Node
s remaining siblings, false
otherwiseprotected boolean visitLeave(FieldInfo fieldInfo)
Node
that is an instance of FieldInfo
.
By default true
is returned.
If you want to do something with a FieldInfo
when leaving it, you have to override this method.
If overriding, you have to return true
if you want to visit any remaining siblings, false
otherwise.
fieldInfo
- the Node
to leavetrue
if, and only if, you want to visit the Node
s remaining siblings, false
otherwiseprotected boolean visitLeave(MethodInfo methodInfo)
Node
that is an instance of MethodInfo
.
By default true
is returned.
If you want to do something with a MethodInfo
when leaving it, you have to override this method.
If overriding, you have to return true
if you want to visit any remaining siblings, false
otherwise.
methodInfo
- the Node
to leavetrue
if, and only if, you want to visit the Node
s remaining siblings, false
otherwise