|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.impl.MessageSupport
org.apache.camel.impl.DefaultMessage
public class DefaultMessage
The default implementation of Message
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
.
Constructor Summary | |
---|---|
DefaultMessage()
|
Method Summary | ||
---|---|---|
void |
addAttachment(String id,
DataHandler content)
Adds an attachment to the message using the id |
|
void |
copyFrom(Message that)
Copies the contents of the other message into this message |
|
protected Map<String,DataHandler> |
createAttachments()
A factory method to lazily create the attachments to make it easy to create efficient Message implementations which only construct and populate the Map on demand |
|
String |
createExchangeId()
Returns the unique ID for a message exchange if this message is capable of creating one or null if not |
|
protected Map<String,Object> |
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 |
|
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 |
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 |
|
boolean |
hasAttachments()
Returns whether this message has attachments. |
|
boolean |
hasHeaders()
Returns whether has any headers has been set. |
|
protected boolean |
hasPopulatedHeaders()
Returns true if the headers have been mutated in some way |
|
boolean |
isFault()
Returns true if this message represents a fault |
|
DefaultMessage |
newInstance()
Returns a new instance |
|
protected void |
populateInitialAttachments(Map<String,DataHandler> map)
A strategy method populate the initial set of attachments on an inbound message from an underlying binding |
|
protected void |
populateInitialHeaders(Map<String,Object> map)
A strategy method populate the initial set of headers on an inbound message from an underlying binding |
|
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 |
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 |
|
String |
toString()
|
Methods inherited from class org.apache.camel.impl.MessageSupport |
---|
copy, createBody, createMessageId, getBody, getBody, getBody, getExchange, getMandatoryBody, getMandatoryBody, getMessageId, setBody, setBody, setExchange, setMessageId |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DefaultMessage()
Method Detail |
---|
public String toString()
toString
in class Object
public void copyFrom(Message that)
Message
copyFrom
in interface Message
copyFrom
in class MessageSupport
that
- the other messagepublic boolean isFault()
Message
public void setFault(boolean fault)
Message
fault
- the fault flagpublic Object getHeader(String name)
Message
name
- name of header
public <T> T getHeader(String name, Class<T> type)
Message
name
- the name of the headertype
- the type of the header
public void setHeader(String name, Object value)
Message
name
- of the headervalue
- to associate with the namepublic Object removeHeader(String name)
Message
name
- name of the header
public Map<String,Object> getHeaders()
Message
public void setHeaders(Map<String,Object> headers)
Message
headers
- headers to setpublic boolean hasHeaders()
Message
public DefaultMessage newInstance()
MessageSupport
newInstance
in class MessageSupport
protected Map<String,Object> createHeaders()
protected Map<String,DataHandler> createAttachments()
protected void populateInitialHeaders(Map<String,Object> map)
map
- is the empty header map to populateprotected void populateInitialAttachments(Map<String,DataHandler> map)
map
- is the empty attachment map to populatepublic void addAttachment(String id, DataHandler content)
Message
id
- the id to store the attachment undercontent
- the data handler for the attachmentpublic DataHandler getAttachment(String id)
Message
id
- the id under which the attachment is stored
public Set<String> getAttachmentNames()
Message
public void removeAttachment(String id)
Message
id
- the id of the attachment to removepublic Map<String,DataHandler> getAttachments()
Message
public void setAttachments(Map<String,DataHandler> attachments)
Message
attachments
- attachementspublic boolean hasAttachments()
Message
protected boolean hasPopulatedHeaders()
public String createExchangeId()
Message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |