Package org.apache.camel.support
Class MessageSupport
java.lang.Object
org.apache.camel.support.MessageSupport
- All Implemented Interfaces:
org.apache.camel.CamelContextAware
,org.apache.camel.Message
,org.apache.camel.spi.DataTypeAware
,org.apache.camel.spi.HasCamelContext
- Direct Known Subclasses:
DefaultMessage
public abstract class MessageSupport
extends Object
implements org.apache.camel.Message, org.apache.camel.CamelContextAware, org.apache.camel.spi.DataTypeAware
A base class for implementation inheritance providing the core
Message
body handling features but letting the
derived class deal with headers.
Unless a specific provider wishes to do something particularly clever with headers you probably want to just derive
from DefaultMessage
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.camel.CamelContext
protected org.apache.camel.TypeConverter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.Message
copy()
void
copyFrom
(org.apache.camel.Message that) void
copyFromWithNewBody
(org.apache.camel.Message that, Object newBody) protected Object
A factory method to allow a provider to lazily create the message body for inbound messages from other sourcesprotected String
Allow implementations to auto-create a messageIdgetBody()
<T> T
protected <T> T
org.apache.camel.CamelContext
org.apache.camel.spi.DataType
org.apache.camel.Exchange
<T> T
getMandatoryBody
(Class<T> type) long
getPayloadForTrait
(org.apache.camel.trait.message.MessageTrait trait) boolean
boolean
boolean
hasTrait
(org.apache.camel.trait.message.MessageTrait trait) abstract org.apache.camel.Message
Returns a new instancevoid
reset()
void
<T> void
void
void
setCamelContext
(org.apache.camel.CamelContext camelContext) void
setDataType
(org.apache.camel.spi.DataType type) void
setExchange
(org.apache.camel.Exchange exchange) void
setMessageId
(String messageId) void
setPayloadForTrait
(org.apache.camel.trait.message.MessageTrait trait, Object object) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.camel.Message
getHeader, getHeader, getHeader, getHeader, getHeader, getHeader, getHeaders, hasHeaders, removeHeader, removeHeaders, removeHeaders, setHeader, setHeaders
-
Field Details
-
camelContext
protected org.apache.camel.CamelContext camelContext -
typeConverter
protected org.apache.camel.TypeConverter typeConverter
-
-
Constructor Details
-
MessageSupport
public MessageSupport()
-
-
Method Details
-
reset
public void reset()- Specified by:
reset
in interfaceorg.apache.camel.Message
-
toString
-
getBody
- Specified by:
getBody
in interfaceorg.apache.camel.Message
-
getBody
- Specified by:
getBody
in interfaceorg.apache.camel.Message
-
getMandatoryBody
- Specified by:
getMandatoryBody
in interfaceorg.apache.camel.Message
- Throws:
org.apache.camel.InvalidPayloadException
-
getBody
-
getMandatoryBody
- Specified by:
getMandatoryBody
in interfaceorg.apache.camel.Message
- Throws:
org.apache.camel.InvalidPayloadException
-
setBody
- Specified by:
setBody
in interfaceorg.apache.camel.Message
-
setBody
- Specified by:
setBody
in interfaceorg.apache.camel.Message
-
setBody
- Specified by:
setBody
in interfaceorg.apache.camel.spi.DataTypeAware
-
getDataType
public org.apache.camel.spi.DataType getDataType()- Specified by:
getDataType
in interfaceorg.apache.camel.spi.DataTypeAware
-
setDataType
public void setDataType(org.apache.camel.spi.DataType type) - Specified by:
setDataType
in interfaceorg.apache.camel.spi.DataTypeAware
-
hasDataType
public boolean hasDataType()- Specified by:
hasDataType
in interfaceorg.apache.camel.spi.DataTypeAware
-
copy
public org.apache.camel.Message copy()- Specified by:
copy
in interfaceorg.apache.camel.Message
-
copyFrom
public void copyFrom(org.apache.camel.Message that) - Specified by:
copyFrom
in interfaceorg.apache.camel.Message
-
copyFromWithNewBody
- Specified by:
copyFromWithNewBody
in interfaceorg.apache.camel.Message
-
getExchange
public org.apache.camel.Exchange getExchange()- Specified by:
getExchange
in interfaceorg.apache.camel.Message
-
setExchange
public void setExchange(org.apache.camel.Exchange exchange) -
getCamelContext
public org.apache.camel.CamelContext getCamelContext()- Specified by:
getCamelContext
in interfaceorg.apache.camel.spi.HasCamelContext
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext) - Specified by:
setCamelContext
in interfaceorg.apache.camel.CamelContextAware
-
newInstance
public abstract org.apache.camel.Message newInstance()Returns a new instance -
createBody
A factory method to allow a provider to lazily create the message body for inbound messages from other sources- Returns:
- the value of the message body or null if there is no value available
-
getMessageId
- Specified by:
getMessageId
in interfaceorg.apache.camel.Message
-
getMessageTimestamp
public long getMessageTimestamp()- Specified by:
getMessageTimestamp
in interfaceorg.apache.camel.Message
-
setMessageId
- Specified by:
setMessageId
in interfaceorg.apache.camel.Message
-
hasMessageId
public boolean hasMessageId()- Specified by:
hasMessageId
in interfaceorg.apache.camel.Message
-
createMessageId
Allow implementations to auto-create a messageId -
hasTrait
public boolean hasTrait(org.apache.camel.trait.message.MessageTrait trait) - Specified by:
hasTrait
in interfaceorg.apache.camel.Message
-
getPayloadForTrait
- Specified by:
getPayloadForTrait
in interfaceorg.apache.camel.Message
-
setPayloadForTrait
- Specified by:
setPayloadForTrait
in interfaceorg.apache.camel.Message
-