Package org.apache.camel.support
Class DefaultMessage
java.lang.Object
org.apache.camel.support.MessageSupport
org.apache.camel.support.DefaultMessage
- All Implemented Interfaces:
org.apache.camel.CamelContextAware
,org.apache.camel.Message
,org.apache.camel.spi.DataTypeAware
,org.apache.camel.spi.HasCamelContext
The default implementation of
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
.-
Field Summary
Fields inherited from class org.apache.camel.support.MessageSupport
camelContext, typeConverter
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultMessage
(org.apache.camel.CamelContext camelContext) DefaultMessage
(org.apache.camel.Exchange exchange) -
Method Summary
Modifier and TypeMethodDescriptionA 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<T> T
<T> T
<T> T
boolean
protected boolean
Returns true if the headers have been mutated in some wayReturns a new instanceprotected void
A strategy method populate the initial set of headers on an inbound message from an underlying bindingremoveHeader
(String name) boolean
removeHeaders
(String pattern) boolean
removeHeaders
(String pattern, String... excludePatterns) void
reset()
void
void
setHeaders
(Map<String, Object> headers) Methods inherited from class org.apache.camel.support.MessageSupport
copy, copyFrom, copyFromWithNewBody, createBody, createMessageId, getBody, getBody, getBody, getCamelContext, getDataType, getExchange, getMandatoryBody, getMandatoryBody, getMessageId, getMessageTimestamp, getPayloadForTrait, hasDataType, hasMessageId, hasTrait, setBody, setBody, setBody, setCamelContext, setDataType, setExchange, setMessageId, setPayloadForTrait, toString
-
Constructor Details
-
DefaultMessage
public DefaultMessage(org.apache.camel.Exchange exchange) -
DefaultMessage
public DefaultMessage(org.apache.camel.CamelContext camelContext)
-
-
Method Details
-
reset
public void reset()- Specified by:
reset
in interfaceorg.apache.camel.Message
- Overrides:
reset
in classMessageSupport
-
getHeader
-
getHeader
-
getHeader
-
getHeader
-
getHeader
-
getHeader
-
setHeader
-
removeHeader
-
removeHeaders
-
removeHeaders
-
getHeaders
-
setHeaders
-
hasHeaders
public boolean hasHeaders() -
newInstance
Description copied from class:MessageSupport
Returns a new instance- Specified by:
newInstance
in classMessageSupport
-
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- Returns:
- return a newly constructed Map possibly containing headers from the underlying inbound transport
-
populateInitialHeaders
A strategy method populate the initial set of headers on an inbound message from an underlying binding- Parameters:
map
- is the empty header map to populate
-
hasPopulatedHeaders
protected boolean hasPopulatedHeaders()Returns true if the headers have been mutated in some way
-