public class MethodCallingVisitor extends TraversalCheckingVisitor implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.lang.Object[] |
arguments |
private java.util.List |
componentInstances |
private java.lang.reflect.Method |
method |
private java.lang.Class |
type |
private boolean |
visitInInstantiationOrder |
Constructor and Description |
---|
MethodCallingVisitor(java.lang.reflect.Method method,
java.lang.Class ofType,
java.lang.Object[] arguments)
Construct a MethodCallingVisitor for standard methods visiting the component in instantiation order.
|
MethodCallingVisitor(java.lang.reflect.Method method,
java.lang.Class ofType,
java.lang.Object[] arguments,
boolean visitInInstantiationOrder)
Construct a MethodCallingVisitor for a method with arguments.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object[] |
getArguments() |
protected java.lang.reflect.Method |
getMethod() |
protected java.lang.Object |
invoke(java.lang.Object target) |
protected void |
invoke(java.lang.Object[] targets) |
java.lang.Object |
traverse(java.lang.Object node)
Entry point for the PicoVisitor traversal.
|
void |
visitContainer(PicoContainer pico)
Visit a
PicoContainer that has to accept the visitor. |
visitComponentAdapter, visitParameter
checkTraversal
private transient java.lang.reflect.Method method
private final java.lang.Object[] arguments
private final java.lang.Class type
private final boolean visitInInstantiationOrder
private final java.util.List componentInstances
public MethodCallingVisitor(java.lang.reflect.Method method, java.lang.Class ofType, java.lang.Object[] arguments, boolean visitInInstantiationOrder)
method
- the Method
to invokeofType
- the type of the components, that will be invokedvisitInInstantiationOrder
- true
if components are visited in instantiation orderarguments
- the arguments for the method invocation (may be null
)java.lang.NullPointerException
- if method, or ofType is null
public MethodCallingVisitor(java.lang.reflect.Method method, java.lang.Class ofType, java.lang.Object[] arguments)
method
- the method to invokeofType
- the type of the components, that will be invokedarguments
- the arguments for the method invocation (may be null
)java.lang.NullPointerException
- if method, or ofType is null
public java.lang.Object traverse(java.lang.Object node)
PicoVisitor
PicoContainer
, ComponentAdapter
,
or Parameter
are valid.traverse
in interface PicoVisitor
traverse
in class AbstractPicoVisitor
node
- the start node of the traversal.public void visitContainer(PicoContainer pico)
PicoVisitor
PicoContainer
that has to accept the visitor.visitContainer
in interface PicoVisitor
visitContainer
in class TraversalCheckingVisitor
pico
- the visited container.protected java.lang.reflect.Method getMethod()
protected java.lang.Object[] getArguments()
protected void invoke(java.lang.Object[] targets)
protected java.lang.Object invoke(java.lang.Object target)