org.springframework.integration.handler
Class DefaultMessageHandlerAdapter<T>

java.lang.Object
  extended by org.springframework.integration.handler.AbstractMessageHandlerAdapter<T>
      extended by org.springframework.integration.handler.DefaultMessageHandlerAdapter<T>
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, MessageHandler

public class DefaultMessageHandlerAdapter<T>
extends AbstractMessageHandlerAdapter<T>
implements org.springframework.core.Ordered

An implementation of MessageHandler that invokes the specified method on the provided target object. If shouldUseMapperOnInvocation is set to true (the default), it will use the provided MessageMapper strategy to convert the inbound Message to an object that will be passed as the method parameter. If the method has a non-null return value, a reply message will be generated by the mapper.

Author:
Mark Fisher

Field Summary
 
Fields inherited from class org.springframework.integration.handler.AbstractMessageHandlerAdapter
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
DefaultMessageHandlerAdapter()
           
 
Method Summary
 java.lang.Object doHandle(Message message, SimpleMethodInvoker invoker)
          Subclasses must implement this method.
 void setShouldUseMapperOnInvocation(boolean shouldUseMapperOnInvocation)
          Specify whether the handler method should use the MessageMapper when invoking the target method.
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandlerAdapter
afterPropertiesSet, getMapper, getMethodName, getObject, getOrder, handle, isInitialized, setMapper, setMethodName, setObject, setOrder, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.core.Ordered
getOrder
 

Constructor Detail

DefaultMessageHandlerAdapter

public DefaultMessageHandlerAdapter()
Method Detail

setShouldUseMapperOnInvocation

public void setShouldUseMapperOnInvocation(boolean shouldUseMapperOnInvocation)
Specify whether the handler method should use the MessageMapper when invoking the target method. Default is true. To force passing the Message directly, set this to false.


doHandle

public java.lang.Object doHandle(Message message,
                                 SimpleMethodInvoker invoker)
Description copied from class: AbstractMessageHandlerAdapter
Subclasses must implement this method. The invoker has been created for the provided target object and method. May return an object of type Message, else rely on the message mapper to convert.

Specified by:
doHandle in class AbstractMessageHandlerAdapter<T>