public abstract class AbstractMethodInvokingDelegator<T>
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean
Exception
s thrown by a successfully invoked delegate method are
re-thrown without wrapping. In case the delegate method throws a
Throwable
that doesn't subclass Exception
it will be wrapped
by AbstractMethodInvokingDelegator.InvocationTargetThrowableWrapper
.Modifier and Type | Class and Description |
---|---|
static class |
AbstractMethodInvokingDelegator.InvocationTargetThrowableWrapper
Used to wrap a
Throwable (not an Exception ) thrown by a
reflectively-invoked delegate. |
Constructor and Description |
---|
AbstractMethodInvokingDelegator() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected T |
invokeDelegateMethod()
Invoker the target method with arguments set by
setArguments(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) |
protected T invokeDelegateMethod() throws java.lang.Exception
setArguments(Object[])
.DynamicMethodInvocationException
- if the MethodInvoker
used throws exceptionjava.lang.Exception
protected T invokeDelegateMethodWithArgument(java.lang.Object object) throws java.lang.Exception
object
- argument for the target methodDynamicMethodInvocationException
- if the MethodInvoker
used throws exceptionjava.lang.Exception
protected T invokeDelegateMethodWithArguments(java.lang.Object[] args) throws java.lang.Exception
args
- arguments for the invoked methodDynamicMethodInvocationException
- if the MethodInvoker
used throws exceptionjava.lang.Exception
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void setTargetObject(java.lang.Object targetObject)
targetObject
- the delegate - bean id can be used to set this value
in Spring configurationpublic void setTargetMethod(java.lang.String targetMethod)
targetMethod
- name of the method to be invoked on
setTargetObject(Object)
.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 value afterPropertiesSet()
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.