Package javax.enterprise.util
Class TypeLiteral<T>
- java.lang.Object
-
- javax.enterprise.util.TypeLiteral<T>
-
- Type Parameters:
T- the type, including all actual type parameters
- All Implemented Interfaces:
java.io.Serializable
public abstract class TypeLiteral<T> extends java.lang.Object implements java.io.SerializableSupports 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>>() { };
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.TypeactualTypeprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description protectedTypeLiteral()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.Class<T>getRawType()java.lang.reflect.TypegetType()private static java.lang.Class<?>getTypeLiteralSubclass(java.lang.Class<?> clazz)private static java.lang.reflect.TypegetTypeParameter(java.lang.Class<?> superclass)inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
actualType
private transient java.lang.reflect.Type actualType
-
-
Method Detail
-
getType
public final java.lang.reflect.Type getType()
- Returns:
- the actual type represented by this object
-
getRawType
public final java.lang.Class<T> getRawType()
- Returns:
- the raw type represented by this object
-
getTypeLiteralSubclass
private static java.lang.Class<?> getTypeLiteralSubclass(java.lang.Class<?> clazz)
-
getTypeParameter
private static java.lang.reflect.Type getTypeParameter(java.lang.Class<?> superclass)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-