org.springframework.integration.handler.annotation
Class MethodArgumentMessageMapper<T>

java.lang.Object
  extended by org.springframework.integration.handler.annotation.MethodArgumentMessageMapper<T>
All Implemented Interfaces:
MessageMapper<T,java.lang.Object[]>

public class MethodArgumentMessageMapper<T>
extends java.lang.Object
implements MessageMapper<T,java.lang.Object[]>

Prepares arguments for handler methods. The method parameters are matched against the Message payload as well as its headers. If a method parameter is annotated with @Header, the annotation's value will be used as a header name. If such an annotation contains no value, then the parameter name will be used as long as the information is available in the class file (requires compilation with debug settings for parameter names). If the @Header annotation is not present, then the parameter will typically match the Message payload. However, if a Map or Properties object is expected, and the paylaod is not itself assignable to that type, then the MessageHeaders' values will be passed in the case of a Map-typed parameter, or the MessageHeaders' String-based values will be passed in the case of a Properties-typed parameter.

Author:
Mark Fisher

Nested Class Summary
private static class MethodArgumentMessageMapper.MethodParameterMetadata
           
 
Field Summary
private  java.lang.reflect.Method method
           
private  MethodArgumentMessageMapper.MethodParameterMetadata[] parameterMetadata
           
private  org.springframework.core.ParameterNameDiscoverer parameterNameDiscoverer
           
 
Constructor Summary
MethodArgumentMessageMapper(java.lang.reflect.Method method)
           
 
Method Summary
private  java.util.Properties getStringTypedHeaders(Message<?> message)
           
private  void initializeParameterMetadata()
           
 java.lang.Object[] mapMessage(Message<T> message)
          Map from the given Message to an Object.
private  java.lang.String resolveParameterNameIfNecessary(java.lang.String paramName, org.springframework.core.MethodParameter methodParam)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

method

private final java.lang.reflect.Method method

parameterMetadata

private volatile MethodArgumentMessageMapper.MethodParameterMetadata[] parameterMetadata

parameterNameDiscoverer

private final org.springframework.core.ParameterNameDiscoverer parameterNameDiscoverer
Constructor Detail

MethodArgumentMessageMapper

public MethodArgumentMessageMapper(java.lang.reflect.Method method)
Method Detail

mapMessage

public java.lang.Object[] mapMessage(Message<T> message)
Description copied from interface: MessageMapper
Map from the given Message to an Object.

Specified by:
mapMessage in interface MessageMapper<T,java.lang.Object[]>

initializeParameterMetadata

private void initializeParameterMetadata()

getStringTypedHeaders

private java.util.Properties getStringTypedHeaders(Message<?> message)

resolveParameterNameIfNecessary

private java.lang.String resolveParameterNameIfNecessary(java.lang.String paramName,
                                                         org.springframework.core.MethodParameter methodParam)