public abstract class AbstractHeaderMapper<T> extends java.lang.Object implements RequestReplyHeaderMapper<T>
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger |
static java.lang.String |
STANDARD_REPLY_HEADER_NAME_PATTERN |
static java.lang.String |
STANDARD_REQUEST_HEADER_NAME_PATTERN |
Modifier | Constructor and Description |
---|---|
protected |
AbstractHeaderMapper() |
Modifier and Type | Method and Description |
---|---|
protected abstract java.util.Map<java.lang.String,java.lang.Object> |
extractStandardHeaders(T source) |
protected abstract java.util.Map<java.lang.String,java.lang.Object> |
extractUserDefinedHeaders(T source) |
void |
fromHeadersToReply(MessageHeaders headers,
T target)
Maps headers from a Spring Integration MessageHeaders instance to the target instance
matching on the set of REPLY headers (if different).
|
void |
fromHeadersToRequest(MessageHeaders headers,
T target)
Maps headers from a Spring Integration MessageHeaders instance to the target instance
matching on the set of REQUEST headers (if different).
|
protected <V> V |
getHeaderIfAvailable(java.util.Map<java.lang.String,java.lang.Object> headers,
java.lang.String name,
java.lang.Class<V> type) |
protected abstract java.lang.String |
getStandardHeaderPrefix()
Returns the list of standard REPLY headers.
|
protected java.util.List<java.lang.String> |
getStandardReplyHeaderNames()
Returns the list of standard REQUEST headers.
|
protected java.util.List<java.lang.String> |
getStandardRequestHeaderNames()
Returns the PREFIX used by standard headers (if any)
|
protected abstract void |
populateStandardHeaders(java.util.Map<java.lang.String,java.lang.Object> headers,
T target) |
protected abstract void |
populateUserDefinedHeader(java.lang.String headerName,
java.lang.Object headerValue,
T target) |
void |
setReplyHeaderNames(java.lang.String[] replyHeaderNames)
Provide the header names that should be mapped to a response (for inbound/outbound adapters)
FROM a Spring Integration Message's headers.
|
void |
setRequestHeaderNames(java.lang.String[] requestHeaderNames)
Provide the header names that should be mapped from a request (for inbound/outbound adapters)
TO a Spring Integration Message's headers.
|
void |
setUserDefinedHeaderPrefix(java.lang.String userDefinedHeaderPrefix)
Specify a prefix to be prepended to the header name for any integration
message header that is being mapped to or from a user-defined value.
|
java.util.Map<java.lang.String,java.lang.Object> |
toHeadersFromReply(T source)
Maps headers/properties of the target object to Map of MessageHeaders
matching on the set of REPLY headers
|
java.util.Map<java.lang.String,java.lang.Object> |
toHeadersFromRequest(T source)
Maps headers/properties of the target object to Map of MessageHeaders
matching on the set of REQUEST headers
|
public static final java.lang.String STANDARD_REQUEST_HEADER_NAME_PATTERN
public static final java.lang.String STANDARD_REPLY_HEADER_NAME_PATTERN
protected final org.apache.commons.logging.Log logger
public void setRequestHeaderNames(java.lang.String[] requestHeaderNames)
This will match the header name directly or, for non-standard headers, it will match
the header name prefixed with the value, if specified, by setUserDefinedHeaderPrefix(String)
.
public void setReplyHeaderNames(java.lang.String[] replyHeaderNames)
Any non-standard headers will be prefixed with the value specified by setUserDefinedHeaderPrefix(String)
.
public void setUserDefinedHeaderPrefix(java.lang.String userDefinedHeaderPrefix)
This does not affect the standard properties for the particular protocol, such as contentType for AMQP, etc. The header names used for mapping such properties are defined in a corresponding Headers class as constants (e.g. AmqpHeaders).
public void fromHeadersToRequest(MessageHeaders headers, T target)
fromHeadersToRequest
in interface RequestReplyHeaderMapper<T>
public void fromHeadersToReply(MessageHeaders headers, T target)
fromHeadersToReply
in interface RequestReplyHeaderMapper<T>
public java.util.Map<java.lang.String,java.lang.Object> toHeadersFromRequest(T source)
toHeadersFromRequest
in interface RequestReplyHeaderMapper<T>
public java.util.Map<java.lang.String,java.lang.Object> toHeadersFromReply(T source)
toHeadersFromReply
in interface RequestReplyHeaderMapper<T>
protected <V> V getHeaderIfAvailable(java.util.Map<java.lang.String,java.lang.Object> headers, java.lang.String name, java.lang.Class<V> type)
protected java.util.List<java.lang.String> getStandardReplyHeaderNames()
protected java.util.List<java.lang.String> getStandardRequestHeaderNames()
protected abstract java.lang.String getStandardHeaderPrefix()
protected abstract java.util.Map<java.lang.String,java.lang.Object> extractStandardHeaders(T source)
protected abstract java.util.Map<java.lang.String,java.lang.Object> extractUserDefinedHeaders(T source)
protected abstract void populateStandardHeaders(java.util.Map<java.lang.String,java.lang.Object> headers, T target)
protected abstract void populateUserDefinedHeader(java.lang.String headerName, java.lang.Object headerValue, T target)