|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compass.core.util.MethodInvoker
public class MethodInvoker
Helper class that allows to specify a method to invoke in a declarative fashion, be it static or non-static.
Usage: Specify targetClass/targetMethod respectively targetObject/targetMethod, optionally specify arguments, prepare the invoker. Afterwards, you can invoke the method any number of times.
Typically not used directly but via its subclasses MethodInvokingFactoryBean and MethodInvokingJobDetailFactoryBean.
prepare(),
invoke()| Constructor Summary | |
|---|---|
MethodInvoker()
|
|
| Method Summary | |
|---|---|
protected Method |
findMatchingMethod()
Find a matching method with the specified name for the specified arguments. |
Object[] |
getArguments()
Retrun the arguments for the method invocation. |
Method |
getPreparedMethod()
Return the prepared Method object that will be invoker. |
Class |
getTargetClass()
Return the target class on which to call the target method. |
String |
getTargetMethod()
Return the name of the method to be invoked. |
Object |
getTargetObject()
Return the target object on which to call the target method. |
Object |
invoke()
Invoke the specified method. |
Object |
invoke(Object targetObject,
Object[] arguments)
Another invoke option. |
MethodInvoker |
prepare()
Prepare the specified method. |
void |
setArguments(Object[] arguments)
Set arguments for the method invocation. |
void |
setStaticMethod(String staticMethod)
Set a fully qualified static method name to invoke, e.g. |
void |
setTargetClass(Class targetClass)
Set the target class on which to call the target method. |
void |
setTargetMethod(String targetMethod)
Set the name of the method to be invoked. |
void |
setTargetObject(Object targetObject)
Set the target object on which to call the target method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MethodInvoker()
| Method Detail |
|---|
public void setTargetClass(Class targetClass)
setTargetObject(java.lang.Object),
setTargetMethod(java.lang.String)public Class getTargetClass()
public void setTargetObject(Object targetObject)
setTargetClass(java.lang.Class),
setTargetMethod(java.lang.String)public Object getTargetObject()
public void setTargetMethod(String targetMethod)
setTargetClass(java.lang.Class),
setTargetObject(java.lang.Object)public String getTargetMethod()
public void setStaticMethod(String staticMethod)
throws ClassNotFoundException
ClassNotFoundExceptionsetTargetClass(java.lang.Class),
setTargetMethod(java.lang.String)public void setArguments(Object[] arguments)
public Object[] getArguments()
public MethodInvoker prepare()
throws ClassNotFoundException,
NoSuchMethodException
ClassNotFoundException
NoSuchMethodExceptiongetPreparedMethod(),
invoke()protected Method findMatchingMethod()
null if nonegetTargetClass(),
getTargetMethod(),
getArguments()public Method getPreparedMethod()
prepare(),
invoke()
public Object invoke()
throws InvocationTargetException,
IllegalAccessException
null if the method has a void return type
InvocationTargetException
IllegalAccessExceptionprepare()
public Object invoke(Object targetObject,
Object[] arguments)
throws InvocationTargetException,
IllegalAccessException
InvocationTargetException
IllegalAccessException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||