org.picocontainer.visitors
Class MethodCallingVisitor
java.lang.Object
org.picocontainer.visitors.AbstractPicoVisitor
org.picocontainer.visitors.TraversalCheckingVisitor
org.picocontainer.visitors.MethodCallingVisitor
- All Implemented Interfaces:
- Serializable, PicoVisitor
public class MethodCallingVisitor
- extends TraversalCheckingVisitor
- implements Serializable
A PicoVisitor implementation, that calls methods on the components of a specific type.
- Author:
- Aslak Hellesøy, Jörg Schaible
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MethodCallingVisitor
public MethodCallingVisitor(Method method,
Class<?> ofType,
Object[] arguments,
boolean visitInInstantiationOrder)
- Construct a MethodCallingVisitor for a method with arguments.
- Parameters:
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
)
- Throws:
NullPointerException
- if method, or ofType is null
MethodCallingVisitor
public MethodCallingVisitor(Method method,
Class ofType,
Object[] arguments)
- Construct a MethodCallingVisitor for standard methods visiting the component in instantiation order.
- Parameters:
method
- the method to invokeofType
- the type of the components, that will be invokedarguments
- the arguments for the method invocation (may be null
)
- Throws:
NullPointerException
- if method, or ofType is null
traverse
public Object traverse(Object node)
- Description copied from interface:
PicoVisitor
- Entry point for the PicoVisitor traversal. The given node is the first object, that is
asked for acceptance. Only objects of type
PicoContainer
, ComponentAdapter
,
or Parameter
are valid.
- Specified by:
traverse
in interface PicoVisitor
- Overrides:
traverse
in class AbstractPicoVisitor
- Parameters:
node
- the start node of the traversal.
- Returns:
- a visitor-specific value.
visitContainer
public boolean visitContainer(PicoContainer pico)
- Description copied from class:
TraversalCheckingVisitor
- Visit a
PicoContainer
that has to accept the visitor.
- Specified by:
visitContainer
in interface PicoVisitor
- Overrides:
visitContainer
in class TraversalCheckingVisitor
- Parameters:
pico
- the visited container.
- Returns:
- CONTINUE_TRAVERSAL if the traversal should continue.
Any visitor callback that returns ABORT_TRAVERSAL indicates
the desire to abort any further traversal.
getMethod
protected Method getMethod()
getArguments
protected Object[] getArguments()
invoke
protected void invoke(Object[] targets)
invoke
protected Class<Void> invoke(Object target)
Copyright © 2003-2010 Codehaus. All Rights Reserved.