public final class MutableMessageBuilder<T> extends AbstractIntegrationMessageBuilder<T>
Modifier and Type | Method and Description |
---|---|
Message<T> |
build() |
AbstractIntegrationMessageBuilder<T> |
copyHeaders(Map<String,?> headersToCopy)
Copy the name-value pairs from the provided Map.
|
AbstractIntegrationMessageBuilder<T> |
copyHeadersIfAbsent(Map<String,?> headersToCopy)
Copy the name-value pairs from the provided Map.
|
static <T> MutableMessageBuilder<T> |
fromMessage(Message<T> message)
Create a builder for a new
Message instance pre-populated with all of the headers copied from the
provided message. |
protected Object |
getCorrelationId() |
Map<String,Object> |
getHeaders() |
T |
getPayload() |
protected List<List<Object>> |
getSequenceDetails() |
protected Object |
getSequenceNumber() |
protected Object |
getSequenceSize() |
AbstractIntegrationMessageBuilder<T> |
removeHeader(String headerName)
Remove the value for the given header name.
|
AbstractIntegrationMessageBuilder<T> |
removeHeaders(String... headerPatterns)
Removes all headers provided via array of 'headerPatterns'.
|
AbstractIntegrationMessageBuilder<T> |
setHeader(String headerName,
Object headerValue)
Set the value for the given header name.
|
AbstractIntegrationMessageBuilder<T> |
setHeaderIfAbsent(String headerName,
Object headerValue)
Set the value for the given header name only if the header name is not already associated with a value.
|
static <T> MutableMessageBuilder<T> |
withPayload(T payload)
Create a builder for a new
Message instance with the provided payload. |
popSequenceDetails, pushSequenceDetails, setCorrelationId, setErrorChannel, setErrorChannelName, setExpirationDate, setExpirationDate, setPriority, setReplyChannel, setReplyChannelName, setSequenceNumber, setSequenceSize
public T getPayload()
getPayload
in class AbstractIntegrationMessageBuilder<T>
public Map<String,Object> getHeaders()
getHeaders
in class AbstractIntegrationMessageBuilder<T>
public static <T> MutableMessageBuilder<T> fromMessage(Message<T> message)
Message
instance pre-populated with all of the headers copied from the
provided message. The payload of the provided Message will also be used as the payload for the new message.T
- The type of the payload.message
- the Message from which the payload and all headers will be copiedpublic static <T> MutableMessageBuilder<T> withPayload(T payload)
Message
instance with the provided payload.T
- The type of the payload.payload
- the payload for the new messagepublic AbstractIntegrationMessageBuilder<T> setHeader(String headerName, Object headerValue)
AbstractIntegrationMessageBuilder
null
, the header will be removed.setHeader
in class AbstractIntegrationMessageBuilder<T>
headerName
- The header name.headerValue
- The header value.public AbstractIntegrationMessageBuilder<T> setHeaderIfAbsent(String headerName, Object headerValue)
AbstractIntegrationMessageBuilder
setHeaderIfAbsent
in class AbstractIntegrationMessageBuilder<T>
headerName
- The header name.headerValue
- The header value.public AbstractIntegrationMessageBuilder<T> removeHeaders(String... headerPatterns)
AbstractIntegrationMessageBuilder
removeHeaders
in class AbstractIntegrationMessageBuilder<T>
headerPatterns
- The header patterns.public AbstractIntegrationMessageBuilder<T> removeHeader(String headerName)
AbstractIntegrationMessageBuilder
removeHeader
in class AbstractIntegrationMessageBuilder<T>
headerName
- The header name.public AbstractIntegrationMessageBuilder<T> copyHeaders(Map<String,?> headersToCopy)
AbstractIntegrationMessageBuilder
AbstractIntegrationMessageBuilder.copyHeadersIfAbsent(Map)
to avoid overwriting values. Note that the 'id' and 'timestamp' header values
will never be overwritten.copyHeaders
in class AbstractIntegrationMessageBuilder<T>
headersToCopy
- The headers to copy.MessageHeaders.ID
,
MessageHeaders.TIMESTAMP
public AbstractIntegrationMessageBuilder<T> copyHeadersIfAbsent(Map<String,?> headersToCopy)
AbstractIntegrationMessageBuilder
copyHeadersIfAbsent
in class AbstractIntegrationMessageBuilder<T>
headersToCopy
- The headers to copy.protected List<List<Object>> getSequenceDetails()
getSequenceDetails
in class AbstractIntegrationMessageBuilder<T>
protected Object getCorrelationId()
getCorrelationId
in class AbstractIntegrationMessageBuilder<T>
protected Object getSequenceNumber()
getSequenceNumber
in class AbstractIntegrationMessageBuilder<T>
protected Object getSequenceSize()
getSequenceSize
in class AbstractIntegrationMessageBuilder<T>
public Message<T> build()
build
in class AbstractIntegrationMessageBuilder<T>