public abstract class MessageSupport extends Object implements org.apache.camel.Message, org.apache.camel.CamelContextAware, org.apache.camel.spi.DataTypeAware
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
Constructor and Description |
---|
MessageSupport() |
Modifier and Type | Method and Description |
---|---|
org.apache.camel.Message |
copy() |
void |
copyFrom(org.apache.camel.Message that) |
void |
copyFromWithNewBody(org.apache.camel.Message that,
Object newBody) |
protected Object |
createBody()
A factory method to allow a provider to lazily create the message body
for inbound messages from other sources
|
protected String |
createMessageId()
Allow implementations to auto-create a messageId
|
Object |
getBody() |
<T> T |
getBody(Class<T> type) |
protected <T> T |
getBody(Class<T> type,
Object body) |
org.apache.camel.CamelContext |
getCamelContext() |
org.apache.camel.spi.DataType |
getDataType() |
org.apache.camel.Exchange |
getExchange() |
Object |
getMandatoryBody() |
<T> T |
getMandatoryBody(Class<T> type) |
String |
getMessageId() |
boolean |
hasDataType() |
abstract org.apache.camel.Message |
newInstance()
Returns a new instance
|
void |
setBody(Object body) |
<T> void |
setBody(Object value,
Class<T> type) |
void |
setBody(Object body,
org.apache.camel.spi.DataType type) |
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) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public Object getBody()
getBody
in interface org.apache.camel.Message
public <T> T getBody(Class<T> type)
getBody
in interface org.apache.camel.Message
public Object getMandatoryBody() throws org.apache.camel.InvalidPayloadException
getMandatoryBody
in interface org.apache.camel.Message
org.apache.camel.InvalidPayloadException
public <T> T getMandatoryBody(Class<T> type) throws org.apache.camel.InvalidPayloadException
getMandatoryBody
in interface org.apache.camel.Message
org.apache.camel.InvalidPayloadException
public void setBody(Object body)
setBody
in interface org.apache.camel.Message
public <T> void setBody(Object value, Class<T> type)
setBody
in interface org.apache.camel.Message
public void setBody(Object body, org.apache.camel.spi.DataType type)
setBody
in interface org.apache.camel.spi.DataTypeAware
public org.apache.camel.spi.DataType getDataType()
getDataType
in interface org.apache.camel.spi.DataTypeAware
public void setDataType(org.apache.camel.spi.DataType type)
setDataType
in interface org.apache.camel.spi.DataTypeAware
public boolean hasDataType()
hasDataType
in interface org.apache.camel.spi.DataTypeAware
public org.apache.camel.Message copy()
copy
in interface org.apache.camel.Message
public void copyFrom(org.apache.camel.Message that)
copyFrom
in interface org.apache.camel.Message
public void copyFromWithNewBody(org.apache.camel.Message that, Object newBody)
copyFromWithNewBody
in interface org.apache.camel.Message
public org.apache.camel.Exchange getExchange()
getExchange
in interface org.apache.camel.Message
public void setExchange(org.apache.camel.Exchange exchange)
public org.apache.camel.CamelContext getCamelContext()
getCamelContext
in interface org.apache.camel.CamelContextAware
public void setCamelContext(org.apache.camel.CamelContext camelContext)
setCamelContext
in interface org.apache.camel.CamelContextAware
public abstract org.apache.camel.Message newInstance()
protected Object createBody()
public String getMessageId()
getMessageId
in interface org.apache.camel.Message
public void setMessageId(String messageId)
setMessageId
in interface org.apache.camel.Message
protected String createMessageId()
Apache Camel