Package org.glassfish.hk2.api
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
Store the actual raw parameter type.
-
-
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
- Returns:
- the raw type represented by this object
-
getRawType
Gets the base associated class from this type- Parameters:
type- The non-null type to analyze- Returns:
- The base class for the type, or null if there is none (e.g., Wildcard)
-
getTypeLiteralSubclass
Return the direct child class that extends TypeLiteral- Parameters:
clazz- processed class
-
getTypeParameter
Return the value of the type parameter of TypeLiteral. - Parameters:
typeLiteralSubclass- subClass of TypeLiteralto analyze - Returns:
- the parametrized type of TypeLiteral
(aka T)
-
equals
-
hashCode
public int hashCode() -
toString
-