public class DefaultMessage extends MessageSupport
Message
This implementation uses a CaseInsensitiveMap
storing the headers.
This allows us to be able to lookup headers using case insensitive keys, making it easier for end users
as they do not have to be worried about using exact keys.
See more details at CaseInsensitiveMap
.
The implementation of the map can be configured by the HeadersMapFactory
which can be set
on the CamelContext
. The default implementation uses the CaseInsensitiveMap
.Constructor and Description |
---|
DefaultMessage(org.apache.camel.CamelContext camelContext) |
DefaultMessage(org.apache.camel.Exchange exchange) |
Modifier and Type | Method and Description |
---|---|
protected Map<String,Object> |
createHeaders()
A factory method to lazily create the headers to make it easy to create
efficient Message implementations which only construct and populate the
Map on demand
|
Object |
getHeader(String name) |
<T> T |
getHeader(String name,
Class<T> type) |
Object |
getHeader(String name,
Object defaultValue) |
<T> T |
getHeader(String name,
Object defaultValue,
Class<T> type) |
Object |
getHeader(String name,
Supplier<Object> defaultValueSupplier) |
<T> T |
getHeader(String name,
Supplier<Object> defaultValueSupplier,
Class<T> type) |
Map<String,Object> |
getHeaders() |
boolean |
hasHeaders() |
protected boolean |
hasPopulatedHeaders()
Returns true if the headers have been mutated in some way
|
protected Boolean |
isTransactedRedelivered()
A strategy for component specific messages to determine whether the
message is redelivered or not.
|
DefaultMessage |
newInstance()
Returns a new instance
|
protected void |
populateInitialHeaders(Map<String,Object> map)
A strategy method populate the initial set of headers on an inbound
message from an underlying binding
|
Object |
removeHeader(String name) |
boolean |
removeHeaders(String pattern) |
boolean |
removeHeaders(String pattern,
String... excludePatterns) |
void |
setHeader(String name,
Object value) |
void |
setHeaders(Map<String,Object> headers) |
copy, copyFrom, copyFromWithNewBody, createBody, createMessageId, getBody, getBody, getBody, getCamelContext, getDataType, getExchange, getMandatoryBody, getMandatoryBody, getMessageId, hasDataType, setBody, setBody, setBody, setCamelContext, setDataType, setExchange, setMessageId, toString
public DefaultMessage(org.apache.camel.Exchange exchange)
public DefaultMessage(org.apache.camel.CamelContext camelContext)
public boolean removeHeaders(String pattern)
public boolean hasHeaders()
public DefaultMessage newInstance()
MessageSupport
newInstance
in class MessageSupport
protected Map<String,Object> createHeaders()
protected void populateInitialHeaders(Map<String,Object> map)
map
- is the empty header map to populateprotected Boolean isTransactedRedelivered()
protected boolean hasPopulatedHeaders()
Apache Camel