Class DefaultAttachmentMessage

java.lang.Object
org.apache.camel.attachment.DefaultAttachmentMessage
All Implemented Interfaces:
AttachmentMessage, org.apache.camel.Message

public final class DefaultAttachmentMessage extends Object implements AttachmentMessage
  • Constructor Details

    • DefaultAttachmentMessage

      public DefaultAttachmentMessage(org.apache.camel.Message delegate)
  • Method Details

    • reset

      public void reset()
      Specified by:
      reset in interface org.apache.camel.Message
    • getMessageId

      public String getMessageId()
      Specified by:
      getMessageId in interface org.apache.camel.Message
    • setMessageId

      public void setMessageId(String messageId)
      Specified by:
      setMessageId in interface org.apache.camel.Message
    • hasMessageId

      public boolean hasMessageId()
      Specified by:
      hasMessageId in interface org.apache.camel.Message
    • getMessageTimestamp

      public long getMessageTimestamp()
      Specified by:
      getMessageTimestamp in interface org.apache.camel.Message
    • getExchange

      public org.apache.camel.Exchange getExchange()
      Specified by:
      getExchange in interface org.apache.camel.Message
    • getHeader

      public Object getHeader(String name)
      Specified by:
      getHeader in interface org.apache.camel.Message
    • getHeader

      public Object getHeader(String name, Object defaultValue)
      Specified by:
      getHeader in interface org.apache.camel.Message
    • getHeader

      public Object getHeader(String name, Supplier<Object> defaultValueSupplier)
      Specified by:
      getHeader in interface org.apache.camel.Message
    • getHeader

      public <T> T getHeader(String name, Class<T> type)
      Specified by:
      getHeader in interface org.apache.camel.Message
    • getHeader

      public <T> T getHeader(String name, Object defaultValue, Class<T> type)
      Specified by:
      getHeader in interface org.apache.camel.Message
    • getHeader

      public <T> T getHeader(String name, Supplier<Object> defaultValueSupplier, Class<T> type)
      Specified by:
      getHeader in interface org.apache.camel.Message
    • setHeader

      public void setHeader(String name, Object value)
      Specified by:
      setHeader in interface org.apache.camel.Message
    • removeHeader

      public Object removeHeader(String name)
      Specified by:
      removeHeader in interface org.apache.camel.Message
    • removeHeaders

      public boolean removeHeaders(String pattern)
      Specified by:
      removeHeaders in interface org.apache.camel.Message
    • removeHeaders

      public boolean removeHeaders(String pattern, String... excludePatterns)
      Specified by:
      removeHeaders in interface org.apache.camel.Message
    • getHeaders

      public Map<String,Object> getHeaders()
      Specified by:
      getHeaders in interface org.apache.camel.Message
    • setHeaders

      public void setHeaders(Map<String,Object> headers)
      Specified by:
      setHeaders in interface org.apache.camel.Message
    • hasHeaders

      public boolean hasHeaders()
      Specified by:
      hasHeaders in interface org.apache.camel.Message
    • getBody

      public Object getBody()
      Specified by:
      getBody in interface org.apache.camel.Message
    • getMandatoryBody

      public Object getMandatoryBody() throws org.apache.camel.InvalidPayloadException
      Specified by:
      getMandatoryBody in interface org.apache.camel.Message
      Throws:
      org.apache.camel.InvalidPayloadException
    • getBody

      public <T> T getBody(Class<T> type)
      Specified by:
      getBody in interface org.apache.camel.Message
    • getMandatoryBody

      public <T> T getMandatoryBody(Class<T> type) throws org.apache.camel.InvalidPayloadException
      Specified by:
      getMandatoryBody in interface org.apache.camel.Message
      Throws:
      org.apache.camel.InvalidPayloadException
    • setBody

      public void setBody(Object body)
      Specified by:
      setBody in interface org.apache.camel.Message
    • setBody

      public <T> void setBody(Object body, Class<T> type)
      Specified by:
      setBody in interface org.apache.camel.Message
    • copy

      public org.apache.camel.Message copy()
      Specified by:
      copy in interface org.apache.camel.Message
    • copyFrom

      public void copyFrom(org.apache.camel.Message message)
      Specified by:
      copyFrom in interface org.apache.camel.Message
    • copyFromWithNewBody

      public void copyFromWithNewBody(org.apache.camel.Message message, Object newBody)
      Specified by:
      copyFromWithNewBody in interface org.apache.camel.Message
    • getAttachment

      public jakarta.activation.DataHandler getAttachment(String id)
      Description copied from interface: AttachmentMessage
      Returns the attachment specified by the id
      Specified by:
      getAttachment in interface AttachmentMessage
      Parameters:
      id - the id under which the attachment is stored
      Returns:
      the data handler for this attachment or null
    • getAttachmentObject

      public Attachment getAttachmentObject(String id)
      Description copied from interface: AttachmentMessage
      Returns the attachment specified by the id
      Specified by:
      getAttachmentObject in interface AttachmentMessage
      Parameters:
      id - the id under which the attachment is stored
      Returns:
      the attachment or null
    • getAttachmentNames

      public Set<String> getAttachmentNames()
      Description copied from interface: AttachmentMessage
      Returns a set of attachment names of the message
      Specified by:
      getAttachmentNames in interface AttachmentMessage
      Returns:
      a set of attachment names
    • removeAttachment

      public void removeAttachment(String id)
      Description copied from interface: AttachmentMessage
      Removes the attachment specified by the id
      Specified by:
      removeAttachment in interface AttachmentMessage
      Parameters:
      id - the id of the attachment to remove
    • addAttachment

      public void addAttachment(String id, jakarta.activation.DataHandler content)
      Description copied from interface: AttachmentMessage
      Adds an attachment to the message using the id
      Specified by:
      addAttachment in interface AttachmentMessage
      Parameters:
      id - the id to store the attachment under
      content - the data handler for the attachment
    • addAttachmentObject

      public void addAttachmentObject(String id, Attachment content)
      Description copied from interface: AttachmentMessage
      Adds an attachment to the message using the id
      Specified by:
      addAttachmentObject in interface AttachmentMessage
      Parameters:
      id - the id to store the attachment under
      content - the attachment
    • getAttachments

      public Map<String,jakarta.activation.DataHandler> getAttachments()
      Description copied from interface: AttachmentMessage
      Returns all attachments of the message
      Specified by:
      getAttachments in interface AttachmentMessage
      Returns:
      the attachments in a map or null
    • getAttachmentObjects

      public Map<String,Attachment> getAttachmentObjects()
      Description copied from interface: AttachmentMessage
      Returns all attachments of the message
      Specified by:
      getAttachmentObjects in interface AttachmentMessage
      Returns:
      the attachments in a map or null
    • setAttachments

      public void setAttachments(Map<String,jakarta.activation.DataHandler> attachments)
      Description copied from interface: AttachmentMessage
      Set all the attachments associated with this message
      Specified by:
      setAttachments in interface AttachmentMessage
      Parameters:
      attachments - the attachments
    • setAttachmentObjects

      public void setAttachmentObjects(Map<String,Attachment> attachments)
      Description copied from interface: AttachmentMessage
      Set all the attachments associated with this message
      Specified by:
      setAttachmentObjects in interface AttachmentMessage
      Parameters:
      attachments - the attachments
    • hasAttachments

      public boolean hasAttachments()
      Description copied from interface: AttachmentMessage
      Returns whether this message has attachments.
      Specified by:
      hasAttachments in interface AttachmentMessage
      Returns:
      true if this message has any attachments.
    • hasTrait

      public boolean hasTrait(org.apache.camel.trait.message.MessageTrait trait)
      Specified by:
      hasTrait in interface org.apache.camel.Message
    • getPayloadForTrait

      public Object getPayloadForTrait(org.apache.camel.trait.message.MessageTrait trait)
      Specified by:
      getPayloadForTrait in interface org.apache.camel.Message
    • setPayloadForTrait

      public void setPayloadForTrait(org.apache.camel.trait.message.MessageTrait trait, Object object)
      Specified by:
      setPayloadForTrait in interface org.apache.camel.Message