Package org.glassfish.hk2.api
Class TypeLiteral<T>
- java.lang.Object
-
- org.glassfish.hk2.api.TypeLiteral<T>
-
- Type Parameters:
T
-
public abstract class TypeLiteral<T> extends 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 subclassingTypeLiteral
.TypeLiteral<List<String>> stringListType = new TypeLiteral<List<String>>() {};
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TypeLiteral()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Type[]
getParameterTypes()
Gets the types associated with this literalClass<T>
getRawType()
static Class<?>
getRawType(Type type)
Gets the base associated class from this typeType
getType()
int
hashCode()
String
toString()
-
-
-
Method Detail
-
getType
public final Type getType()
- Returns:
- the actual type represented by this object
-
getParameterTypes
public final Type[] getParameterTypes()
Gets the types associated with this literal- Returns:
- A non-null (but possibly empty) array of types associated with this literal
-
getRawType
public static Class<?> getRawType(Type type)
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)
-
-