org.springframework.integration.util
Class AbstractMethodInvokingAdapter

java.lang.Object
  extended by org.springframework.integration.util.AbstractMethodInvokingAdapter
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, MethodInvoker
Direct Known Subclasses:
AbstractMessageHandlerAdapter, AnnotationMethodTransformerAdapter, PayloadTransformerAdapter

public abstract class AbstractMethodInvokingAdapter
extends java.lang.Object
implements MethodInvoker, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered

An base class for adapters that invoke a specified method and target object. Either a Method reference or a 'methodName' may be provided, but both are not necessary. In fact, while preference is given to a Method reference if available, an Exception will be thrown if a non-matching 'methodName' has also been provided. Therefore, to avoid such ambiguity, it is recommended to provide just one or the other.

Author:
Mark Fisher

Field Summary
private  java.lang.Object initializationMonitor
           
private  boolean initialized
           
private  MethodInvoker invoker
           
protected  org.apache.commons.logging.Log logger
           
private  java.lang.reflect.Method method
           
private  java.lang.String methodName
           
private  java.lang.Object object
           
private  int order
           
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
AbstractMethodInvokingAdapter()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  java.lang.reflect.Method getMethod()
           
protected  java.lang.String getMethodName()
           
protected  java.lang.Object getObject()
           
 int getOrder()
           
protected  void initialize()
          Subclasses may override this method for custom initialization requirements.
 java.lang.Object invokeMethod(java.lang.Object... args)
           
protected  boolean isInitialized()
           
 void setMethod(java.lang.reflect.Method method)
           
 void setMethodName(java.lang.String methodName)
           
 void setObject(java.lang.Object object)
           
 void setOrder(int order)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger

object

private volatile java.lang.Object object

method

private volatile java.lang.reflect.Method method

methodName

private volatile java.lang.String methodName

order

private volatile int order

invoker

private volatile MethodInvoker invoker

initialized

private volatile boolean initialized

initializationMonitor

private final java.lang.Object initializationMonitor
Constructor Detail

AbstractMethodInvokingAdapter

public AbstractMethodInvokingAdapter()
Method Detail

setObject

public void setObject(java.lang.Object object)

getObject

protected java.lang.Object getObject()

setMethod

public void setMethod(java.lang.reflect.Method method)

getMethod

protected java.lang.reflect.Method getMethod()

setMethodName

public void setMethodName(java.lang.String methodName)

getMethodName

protected java.lang.String getMethodName()

setOrder

public void setOrder(int order)

getOrder

public int getOrder()
Specified by:
getOrder in interface org.springframework.core.Ordered

isInitialized

protected boolean isInitialized()

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

initialize

protected void initialize()
Subclasses may override this method for custom initialization requirements.


invokeMethod

public java.lang.Object invokeMethod(java.lang.Object... args)
                              throws java.lang.Exception
Specified by:
invokeMethod in interface MethodInvoker
Throws:
java.lang.Exception