Class TypeLiteral<T>

  • Type Parameters:
    T - the type, including all actual type parameters
    All Implemented Interfaces:

    public abstract class TypeLiteral<T>
    extends java.lang.Object

    Supports inline instantiation of objects that represent parameterized types with actual type parameters.

    An object that represents any parameterized type may be obtained by subclassing TypeLiteral.

     TypeLiteral<List<String>> stringListType = new TypeLiteral<List<String>>() {
    See Also:, Annotation...),, Annotation...), Serialized Form
    • Constructor Summary

      Modifier Constructor Description
      protected TypeLiteral()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.Class<T> getRawType()  
      java.lang.reflect.Type getType()  
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • TypeLiteral

        protected TypeLiteral()
    • Method Detail

      • getType

        public final java.lang.reflect.Type getType()
        the actual type represented by this object
      • getRawType

        public final java.lang.Class<T> getRawType()
        the raw type represented by this object
      • equals

        public boolean equals​(java.lang.Object obj)
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object