Package org.apache.camel.attachment
Class DefaultAttachmentMessage
java.lang.Object
org.apache.camel.attachment.DefaultAttachmentMessage
- All Implemented Interfaces:
AttachmentMessage
,org.apache.camel.Message
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttachment
(String id, jakarta.activation.DataHandler content) Adds an attachment to the message using the idvoid
addAttachmentObject
(String id, Attachment content) Adds an attachment to the message using the idvoid
Clears all the attachments.org.apache.camel.Message
copy()
void
copyFrom
(org.apache.camel.Message message) void
copyFromWithNewBody
(org.apache.camel.Message message, Object newBody) jakarta.activation.DataHandler
getAttachment
(String id) Returns the attachment specified by the idReturns a set of attachment names of the messageReturns the attachment specified by the idReturns all attachments of the messageReturns all attachments of the message.getBody()
<T> T
org.apache.camel.Exchange
<T> T
<T> T
<T> T
<T> T
getMandatoryBody
(Class<T> type) long
getPayloadForTrait
(org.apache.camel.trait.message.MessageTrait trait) boolean
Returns whether this message has attachments.boolean
boolean
boolean
hasTrait
(org.apache.camel.trait.message.MessageTrait trait) org.apache.camel.Message
void
Removes the attachment specified by the idremoveHeader
(String name) boolean
removeHeaders
(String pattern) boolean
removeHeaders
(String pattern, String... excludePatterns) void
removeTrait
(org.apache.camel.trait.message.MessageTrait trait) void
reset()
void
setAttachmentObjects
(Map<String, Attachment> attachments) Set all the attachments associated with this messagevoid
setAttachments
(Map<String, jakarta.activation.DataHandler> attachments) Set all the attachments associated with this messagevoid
<T> void
void
void
setHeaders
(Map<String, Object> headers) void
setMessageId
(String messageId) void
setPayloadForTrait
(org.apache.camel.trait.message.MessageTrait trait, Object object)
-
Constructor Details
-
DefaultAttachmentMessage
public DefaultAttachmentMessage(org.apache.camel.Message delegate)
-
-
Method Details
-
newInstance
public org.apache.camel.Message newInstance()- Specified by:
newInstance
in interfaceorg.apache.camel.Message
-
reset
public void reset()- Specified by:
reset
in interfaceorg.apache.camel.Message
-
getMessageId
- Specified by:
getMessageId
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
-
getMessageTimestamp
public long getMessageTimestamp()- Specified by:
getMessageTimestamp
in interfaceorg.apache.camel.Message
-
getExchange
public org.apache.camel.Exchange getExchange()- Specified by:
getExchange
in interfaceorg.apache.camel.Message
-
getHeader
- Specified by:
getHeader
in interfaceorg.apache.camel.Message
-
getHeader
- Specified by:
getHeader
in interfaceorg.apache.camel.Message
-
getHeader
- Specified by:
getHeader
in interfaceorg.apache.camel.Message
-
getHeader
- Specified by:
getHeader
in interfaceorg.apache.camel.Message
-
getHeader
- Specified by:
getHeader
in interfaceorg.apache.camel.Message
-
getHeader
- Specified by:
getHeader
in interfaceorg.apache.camel.Message
-
setHeader
- Specified by:
setHeader
in interfaceorg.apache.camel.Message
-
removeHeader
- Specified by:
removeHeader
in interfaceorg.apache.camel.Message
-
removeHeaders
- Specified by:
removeHeaders
in interfaceorg.apache.camel.Message
-
removeHeaders
- Specified by:
removeHeaders
in interfaceorg.apache.camel.Message
-
getHeaders
- Specified by:
getHeaders
in interfaceorg.apache.camel.Message
-
setHeaders
- Specified by:
setHeaders
in interfaceorg.apache.camel.Message
-
hasHeaders
public boolean hasHeaders()- Specified by:
hasHeaders
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
- Specified by:
getBody
in interfaceorg.apache.camel.Message
-
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
-
copy
public org.apache.camel.Message copy()- Specified by:
copy
in interfaceorg.apache.camel.Message
-
copyFrom
public void copyFrom(org.apache.camel.Message message) - Specified by:
copyFrom
in interfaceorg.apache.camel.Message
-
copyFromWithNewBody
- Specified by:
copyFromWithNewBody
in interfaceorg.apache.camel.Message
-
getAttachment
Description copied from interface:AttachmentMessage
Returns the attachment specified by the id- Specified by:
getAttachment
in interfaceAttachmentMessage
- Parameters:
id
- the id under which the attachment is stored- Returns:
- the data handler for this attachment or null
-
getAttachmentObject
Description copied from interface:AttachmentMessage
Returns the attachment specified by the id- Specified by:
getAttachmentObject
in interfaceAttachmentMessage
- Parameters:
id
- the id under which the attachment is stored- Returns:
- the attachment or null
-
getAttachmentNames
Description copied from interface:AttachmentMessage
Returns a set of attachment names of the message- Specified by:
getAttachmentNames
in interfaceAttachmentMessage
- Returns:
- a set of attachment names
-
removeAttachment
Description copied from interface:AttachmentMessage
Removes the attachment specified by the id- Specified by:
removeAttachment
in interfaceAttachmentMessage
- Parameters:
id
- the id of the attachment to remove
-
addAttachment
Description copied from interface:AttachmentMessage
Adds an attachment to the message using the id- Specified by:
addAttachment
in interfaceAttachmentMessage
- Parameters:
id
- the id to store the attachment undercontent
- the data handler for the attachment
-
addAttachmentObject
Description copied from interface:AttachmentMessage
Adds an attachment to the message using the id- Specified by:
addAttachmentObject
in interfaceAttachmentMessage
- Parameters:
id
- the id to store the attachment undercontent
- the attachment
-
getAttachments
Description copied from interface:AttachmentMessage
Returns all attachments of the message. To add or remove attachments then use the APIs from this message, as the returned map is a read-only instance.- Specified by:
getAttachments
in interfaceAttachmentMessage
- Returns:
- the attachments in a read-only map
-
getAttachmentObjects
Description copied from interface:AttachmentMessage
Returns all attachments of the message To add or remove attachments then use the APIs from this message, as the returned map is a read-only instance.- Specified by:
getAttachmentObjects
in interfaceAttachmentMessage
- Returns:
- the attachments in a read-only map
-
setAttachments
Description copied from interface:AttachmentMessage
Set all the attachments associated with this message- Specified by:
setAttachments
in interfaceAttachmentMessage
- Parameters:
attachments
- the attachments
-
setAttachmentObjects
Description copied from interface:AttachmentMessage
Set all the attachments associated with this message- Specified by:
setAttachmentObjects
in interfaceAttachmentMessage
- Parameters:
attachments
- the attachments
-
hasAttachments
public boolean hasAttachments()Description copied from interface:AttachmentMessage
Returns whether this message has attachments.- Specified by:
hasAttachments
in interfaceAttachmentMessage
- Returns:
- true if this message has any attachments.
-
clearAttachments
public void clearAttachments()Description copied from interface:AttachmentMessage
Clears all the attachments.- Specified by:
clearAttachments
in interfaceAttachmentMessage
-
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
-
removeTrait
public void removeTrait(org.apache.camel.trait.message.MessageTrait trait) - Specified by:
removeTrait
in interfaceorg.apache.camel.Message
-