Class TypeLiteral<T>
java.lang.Object
org.glassfish.hk2.api.TypeLiteral<T>
- Type Parameters:
T-
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>>() {};
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal Type[]Gets the types associated with this literalstatic Class<?> getRawType(Type type) Gets the base associated class from this typefinal TypegetType()private static Class<?> getTypeLiteralSubclass(Class<?> clazz) Return the direct child class that extends TypeLiteralprivate static TypegetTypeParameter(Class<?> typeLiteralSubclass) Return the value of the type parameter of TypeLiteral. inthashCode()toString()
-
Field Details
-
type
Store the actual type (direct subclass of TypeLiteral). -
rawType
-
-
Constructor Details
-
TypeLiteral
protected TypeLiteral()
-
-
Method Details
-
getType
- Returns:
- the actual type represented by this object
-
getParameterTypes
Gets the types associated with this literal- Returns:
- A non-null (but possibly empty) array of types associated with this literal
-
getRawType
-
getRawType
-
getTypeLiteralSubclass
-
getTypeParameter
-
equals
-
hashCode
-
toString
-