|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.impl.MessageSupport
public abstract class MessageSupport
A base class for implementation inheritence 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
Constructor Summary | |
---|---|
MessageSupport()
|
Method Summary | ||
---|---|---|
Message |
copy()
Creates a copy of this message so that it can be used and possibly modified further in another exchange |
|
void |
copyFrom(Message that)
Copies the contents of the other message into this message |
|
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()
Lets allow implementations to auto-create a messageId |
|
Object |
getBody()
Returns the body of the message as a POJO The body can be null if no body is set |
|
|
getBody(Class<T> type)
Returns the body as the specified type |
|
protected
|
getBody(Class<T> type,
Object body)
|
|
Exchange |
getExchange()
Returns the exchange this message is related to |
|
Object |
getMandatoryBody()
Returns the body of the message as a POJO |
|
|
getMandatoryBody(Class<T> type)
Returns the mandatory body as the specified type |
|
String |
getMessageId()
Returns the id of the message |
|
abstract Message |
newInstance()
Returns a new instance |
|
void |
setBody(Object body)
Sets the body of the message |
|
|
setBody(Object value,
Class<T> type)
Sets the body of the message as a specific type |
|
void |
setExchange(Exchange exchange)
|
|
void |
setMessageId(String messageId)
Sets the id of the message |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.camel.Message |
---|
addAttachment, createExchangeId, getAttachment, getAttachmentNames, getAttachments, getHeader, getHeader, getHeaders, hasAttachments, hasHeaders, isFault, removeAttachment, removeHeader, setAttachments, setFault, setHeader, setHeaders |
Constructor Detail |
---|
public MessageSupport()
Method Detail |
---|
public Object getBody()
Message
getBody
in interface Message
public <T> T getBody(Class<T> type)
Message
getBody
in interface Message
type
- the type that the body
public Object getMandatoryBody() throws InvalidPayloadException
Message
getMandatoryBody
in interface Message
InvalidPayloadException
- Is thrown if the body being null or wrong class typeprotected <T> T getBody(Class<T> type, Object body)
public <T> T getMandatoryBody(Class<T> type) throws InvalidPayloadException
Message
getMandatoryBody
in interface Message
type
- the type that the body
InvalidPayloadException
- Is thrown if the body being null or wrong class typepublic void setBody(Object body)
Message
setBody
in interface Message
body
- the bodypublic <T> void setBody(Object value, Class<T> type)
Message
setBody
in interface Message
value
- the bodytype
- the type of the bodypublic Message copy()
Message
copy
in interface Message
public void copyFrom(Message that)
Message
copyFrom
in interface Message
that
- the other messagepublic Exchange getExchange()
Message
getExchange
in interface Message
public void setExchange(Exchange exchange)
public abstract Message newInstance()
protected Object createBody()
public String getMessageId()
Message
getMessageId
in interface Message
public void setMessageId(String messageId)
Message
setMessageId
in interface Message
messageId
- id of the messageprotected String createMessageId()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |