类 AbstractMethodInvokingDelegator<T>
- java.lang.Object
- org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator<T>
- 所有已实现的接口:
org.springframework.beans.factory.InitializingBean
- 直接已知子类:
ItemProcessorAdapter
,ItemReaderAdapter
,ItemWriterAdapter
,MethodInvokingTaskletAdapter
,PropertyExtractingDelegatingItemWriter
public abstract class AbstractMethodInvokingDelegator<T> extends java.lang.Object implements org.springframework.beans.factory.InitializingBean
Superclass for delegating classes which dynamically call a custom method of injected object. Provides convenient API for dynamic method invocation shielding subclasses from low-level details and exception handling.Exception
s thrown by a successfully invoked delegate method are re-thrown without wrapping. In case the delegate method throws aThrowable
that doesn't subclassException
it will be wrapped byAbstractMethodInvokingDelegator.InvocationTargetThrowableWrapper
.- 作者:
- Robert Kasanicky, Mahmoud Ben Hassine
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
AbstractMethodInvokingDelegator.InvocationTargetThrowableWrapper
Used to wrap aThrowable
(not anException
) thrown by a reflectively-invoked delegate.
构造器概要
构造器 构造器 说明 AbstractMethodInvokingDelegator()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
protected java.lang.Object[]
getArguments()
Return arguments.protected T
invokeDelegateMethod()
Invoker the target method with arguments set bysetArguments(Object[])
.protected T
invokeDelegateMethodWithArgument(java.lang.Object object)
Invokes the target method with given argument.protected T
invokeDelegateMethodWithArguments(java.lang.Object[] args)
Invokes the target method with given arguments.void
setArguments(java.lang.Object[] arguments)
void
setTargetMethod(java.lang.String targetMethod)
void
setTargetObject(java.lang.Object targetObject)
构造器详细资料
AbstractMethodInvokingDelegator
public AbstractMethodInvokingDelegator()
方法详细资料
invokeDelegateMethod
protected T invokeDelegateMethod() throws java.lang.Exception
Invoker the target method with arguments set bysetArguments(Object[])
.- 返回:
- object returned by invoked method
- 抛出:
java.lang.Exception
- exception thrown when executing the delegate method.
invokeDelegateMethodWithArgument
protected T invokeDelegateMethodWithArgument(java.lang.Object object) throws java.lang.Exception
Invokes the target method with given argument.- 参数:
object
- argument for the target method- 返回:
- object returned by target method
- 抛出:
java.lang.Exception
- exception thrown when executing the delegate method.
invokeDelegateMethodWithArguments
protected T invokeDelegateMethodWithArguments(java.lang.Object[] args) throws java.lang.Exception
Invokes the target method with given arguments.- 参数:
args
- arguments for the invoked method- 返回:
- object returned by invoked method
- 抛出:
java.lang.Exception
- exception thrown when executing the delegate method.
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception
setTargetObject
public void setTargetObject(java.lang.Object targetObject)
- 参数:
targetObject
- the delegate - bean id can be used to set this value in Spring configuration
setTargetMethod
public void setTargetMethod(java.lang.String targetMethod)
- 参数:
targetMethod
- name of the method to be invoked onsetTargetObject(Object)
.
setArguments
public void setArguments(java.lang.Object[] arguments)
- 参数:
arguments
- arguments values for the {setTargetMethod(String)
. These will be used only when the subclass tries to invoke the target method without providing explicit argument values. If arguments are set to not-null valueafterPropertiesSet()
will check the values are compatible with target method's signature. In case arguments are null (not set) method signature will not be checked and it is assumed correct values will be supplied at runtime.
getArguments
protected java.lang.Object[] getArguments()
Return arguments.- 返回:
- arguments