Interface Attachable

All Known Subinterfaces:
DeploymentPhaseContext, DeploymentUnit
All Known Implementing Classes:
AdditionalModuleSpecification, ModuleSpecification, ResourceRoot, SimpleAttachable

public interface Attachable
An entity which can contain attachments.
  • Method Details

    • hasAttachment

      boolean hasAttachment(AttachmentKey<?> key)
      Check if an attachment exists for this key.
      Parameters:
      key - the attachment key
      Returns:
      false if there is none
    • getAttachment

      <T> T getAttachment(AttachmentKey<T> key)
      Get an attachment value. If no attachment exists for this key, null is returned.
      Type Parameters:
      T - the value type
      Parameters:
      key - the attachment key
      Returns:
      the value, or null if there is none
    • getAttachmentList

      <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key)
      Gets a list attachment value. If not attachment exists for this key an empty list is returned
      Type Parameters:
      T - the value type
      Parameters:
      key - the attachment key
      Returns:
      the value, or an empty list if there is none
    • putAttachment

      <T> T putAttachment(AttachmentKey<T> key, T value)
      Set an attachment value. If an attachment for this key was already set, return the original value. If the value being set is null, the attachment key is removed.
      Type Parameters:
      T - the value type
      Parameters:
      key - the attachment key
      value - the new value
      Returns:
      the old value, or null if there was none
    • removeAttachment

      <T> T removeAttachment(AttachmentKey<T> key)
      Remove an attachment, returning its previous value.
      Type Parameters:
      T - the value type
      Parameters:
      key - the attachment key
      Returns:
      the old value, or null if there was none
    • addToAttachmentList

      <T> void addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value)
      Add a value to a list-typed attachment key. If the key is not mapped, add such a mapping.
      Type Parameters:
      T - the list value type
      Parameters:
      key - the attachment key
      value - the value to add