|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.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()
,
MethodInvokingFactoryBean
,
MethodInvokingJobDetailFactoryBean
Nested Class Summary | |
---|---|
static class |
MethodInvoker.VoidType
Special marker class used for a void return value, differentiating void from a null value returned by the method. |
Field Summary | |
---|---|
static MethodInvoker.VoidType |
VOID
Marker now used only by MethodInvokingFactoryBean, but left here for compatibility |
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. |
void |
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 |
Field Detail |
---|
public static final MethodInvoker.VoidType VOID
Constructor Detail |
---|
public MethodInvoker()
Method Detail |
---|
public void setTargetClass(Class targetClass)
public Class getTargetClass()
public void setTargetObject(Object targetObject)
public Object getTargetObject()
public void setTargetMethod(String targetMethod)
public String getTargetMethod()
public void setStaticMethod(String staticMethod) throws ClassNotFoundException
public void setArguments(Object[] arguments)
public Object[] getArguments()
public void prepare() throws ClassNotFoundException, NoSuchMethodException
ClassNotFoundException
NoSuchMethodException
getPreparedMethod()
,
invoke()
protected Method findMatchingMethod()
null
if nonegetTargetClass()
,
getTargetMethod()
,
getArguments()
public Method getPreparedMethod()
public Object invoke() throws InvocationTargetException, IllegalAccessException
null
if the method has a void return type
InvocationTargetException
IllegalAccessException
prepare()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |