Package org.apache.camel.attachment
Interface AttachmentMessage
- All Superinterfaces:
org.apache.camel.Message
- All Known Implementing Classes:
DefaultAttachmentMessage
public interface AttachmentMessage
extends org.apache.camel.Message
Extended
Message for Java Attachment Support (with jakarta.activation).-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttachment(String id, jakarta.activation.DataHandler content) Adds an attachment to the message using the idvoidaddAttachmentObject(String id, Attachment content) Adds an attachment to the message using the idvoidClears all the attachments.jakarta.activation.DataHandlergetAttachment(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.booleanReturns whether this message has attachments.voidRemoves the attachment specified by the idvoidsetAttachmentObjects(Map<String, Attachment> attachments) Set all the attachments associated with this messagevoidsetAttachments(Map<String, jakarta.activation.DataHandler> attachments) Set all the attachments associated with this messageMethods inherited from interface org.apache.camel.Message
copy, copyFrom, copyFromWithNewBody, getBody, getBody, getExchange, getHeader, getHeader, getHeader, getHeader, getHeader, getHeader, getHeaders, getMandatoryBody, getMandatoryBody, getMessageId, getMessageTimestamp, getPayloadForTrait, hasHeaders, hasMessageId, hasTrait, newInstance, removeHeader, removeHeaders, removeHeaders, removeTrait, reset, setBody, setBody, setHeader, setHeaders, setMessageId, setPayloadForTrait
-
Method Details
-
getAttachment
Returns the attachment specified by the id- Parameters:
id- the id under which the attachment is stored- Returns:
- the data handler for this attachment or null
-
getAttachmentObject
Returns the attachment specified by the id- Parameters:
id- the id under which the attachment is stored- Returns:
- the attachment or null
-
getAttachmentNames
Returns a set of attachment names of the message- Returns:
- a set of attachment names
-
removeAttachment
Removes the attachment specified by the id- Parameters:
id- the id of the attachment to remove
-
addAttachment
Adds an attachment to the message using the id- Parameters:
id- the id to store the attachment undercontent- the data handler for the attachment
-
addAttachmentObject
Adds an attachment to the message using the id- Parameters:
id- the id to store the attachment undercontent- the attachment
-
getAttachments
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.- Returns:
- the attachments in a read-only map
-
getAttachmentObjects
Map<String,Attachment> getAttachmentObjects()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.- Returns:
- the attachments in a read-only map
-
setAttachments
Set all the attachments associated with this message- Parameters:
attachments- the attachments
-
setAttachmentObjects
Set all the attachments associated with this message- Parameters:
attachments- the attachments
-
hasAttachments
boolean hasAttachments()Returns whether this message has attachments.- Returns:
- true if this message has any attachments.
-
clearAttachments
void clearAttachments()Clears all the attachments.
-