|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Message
Implements the Message pattern and
represents an inbound or outbound message as part of an Exchange
DefaultMessage
for how headers is represented in Camel using a
CaseInsensitiveMap
.
Method Summary | ||
---|---|---|
void |
addAttachment(String id,
DataHandler content)
Adds an attachment to the message using the id |
|
Message |
copy()
Creates a copy of this message so that it can be used and possibly modified further in another exchange |
|
void |
copyFrom(Message message)
Copies the contents of the other message into this message |
|
String |
createExchangeId()
Returns the unique ID for a message exchange if this message is capable of creating one or null if not |
|
DataHandler |
getAttachment(String id)
Returns the attachment specified by the id |
|
Set<String> |
getAttachmentNames()
Returns a set of attachment names of the message |
|
Map<String,DataHandler> |
getAttachments()
Returns all attachments of the message |
|
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 |
|
Exchange |
getExchange()
Returns the exchange this message is related to |
|
Object |
getHeader(String name)
Accesses a specific header |
|
|
getHeader(String name,
Class<T> type)
Returns a header associated with this message by name and specifying the type required |
|
Map<String,Object> |
getHeaders()
Returns all of the headers associated with the message |
|
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 |
|
boolean |
hasAttachments()
Returns whether this message has attachments. |
|
boolean |
hasHeaders()
Returns whether has any headers has been set. |
|
boolean |
isFault()
Returns true if this message represents a fault |
|
void |
removeAttachment(String id)
Removes the attachment specified by the id |
|
Object |
removeHeader(String name)
Removes the named header from this message |
|
void |
setAttachments(Map<String,DataHandler> attachments)
Set all the attachments associated with this message |
|
void |
setBody(Object body)
Sets the body of the message |
|
|
setBody(Object body,
Class<T> type)
Sets the body of the message as a specific type |
|
void |
setFault(boolean fault)
Sets the fault flag on this message |
|
void |
setHeader(String name,
Object value)
Sets a header on the message |
|
void |
setHeaders(Map<String,Object> headers)
Set all the headers associated with this message |
|
void |
setMessageId(String messageId)
Sets the id of the message |
Method Detail |
---|
String getMessageId()
void setMessageId(String messageId)
messageId
- id of the messageExchange getExchange()
boolean isFault()
void setFault(boolean fault)
fault
- the fault flagObject getHeader(String name)
name
- name of header
<T> T getHeader(String name, Class<T> type)
name
- the name of the headertype
- the type of the header
void setHeader(String name, Object value)
name
- of the headervalue
- to associate with the nameObject removeHeader(String name)
name
- name of the header
Map<String,Object> getHeaders()
void setHeaders(Map<String,Object> headers)
headers
- headers to setboolean hasHeaders()
Object getBody()
Object getMandatoryBody() throws InvalidPayloadException
InvalidPayloadException
- Is thrown if the body being null or wrong class type<T> T getBody(Class<T> type)
type
- the type that the body
<T> T getMandatoryBody(Class<T> type) throws InvalidPayloadException
type
- the type that the body
InvalidPayloadException
- Is thrown if the body being null or wrong class typevoid setBody(Object body)
body
- the body<T> void setBody(Object body, Class<T> type)
body
- the bodytype
- the type of the bodyMessage copy()
void copyFrom(Message message)
message
- the other messageDataHandler getAttachment(String id)
id
- the id under which the attachment is stored
Set<String> getAttachmentNames()
void removeAttachment(String id)
id
- the id of the attachment to removevoid addAttachment(String id, DataHandler content)
id
- the id to store the attachment undercontent
- the data handler for the attachmentMap<String,DataHandler> getAttachments()
void setAttachments(Map<String,DataHandler> attachments)
attachments
- attachementsboolean hasAttachments()
String createExchangeId()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |