Class Key<T>

  • Type Parameters:
    T -

    public final class Key<T>
    extends Object
    Allows type safe retrieval of a value from TypedIdentityMap
    • Method Detail

      • createKey

        public static <T> Key<T> createKey​(Class<T> clazz)
        Creates a new Key typed by the given Class
        Type Parameters:
        T -
        Parameters:
        clazz - type of the value
        Returns:
        key
      • getValueClass

        public Class<? extends T> getValueClass()
        Gets the Class type used for the Value stored against this key
        Returns:
        valueClass
      • cast

        public <V> V cast​(Object value)
        Casts the given object to getValueClass()
        Type Parameters:
        V -
        Parameters:
        value -
        Returns:
        casted value