Class AttachmentKey<T>

  • Type Parameters:
    T - the attachment type

    public abstract class AttachmentKey<T>
    extends Object
    An immutable, type-safe object attachment key. Such a key has no value outside of its object identity.
    • Method Detail

      • cast

        public abstract T cast​(Object value)
        Cast the value to the type of this attachment key.
        Parameters:
        value - the value
        Returns:
        the cast value
      • create

        public static <T> AttachmentKey<T> create​(Class<? super T> valueClass)
        Construct a new simple attachment key.
        Type Parameters:
        T - the attachment type
        Parameters:
        valueClass - the value class
        Returns:
        the new instance
      • createList

        public static <T> AttachmentKey<AttachmentList<T>> createList​(Class<? super T> valueClass)
        Construct a new list attachment key.
        Type Parameters:
        T - the list value type
        Parameters:
        valueClass - the list value class
        Returns:
        the new instance