T
- the type, including all type parameterspublic class TypeLiteral<T> extends Object implements Serializable
Class for instantiation of objects that represent parameterized types with current parameters.
An object that represents a parameterized type may be obtained by subclassing TypeLiteral.
TypeLiteral<List<Integer>> stringListType = new TypeLiteral<List<Integer>>() {};
Constructor and Description |
---|
TypeLiteral()
Constructor only for directly implemeting a TypeLiteral hereby dynamically implementing a generic interface.
|
TypeLiteral(Type definedType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
protected Type |
getDefinedType(Class<?> clazz) |
static Type[] |
getGenericInterfaceTypeParameters(Class<?> clazz,
Class<?> interfaceType)
Checks the current implemented generic interfaces and evaluates the given single type parameter.
|
Class<T> |
getRawType()
Returns basic raw Java type.
|
Type |
getType() |
static Type[] |
getTypeParameters(Type type)
Method that checks the class's type for a generic interface implementation type.
|
int |
hashCode() |
static <R> TypeLiteral<R> |
of(Type type)
Creates a new TypeLiteral based on a given type.
|
String |
toString() |
public TypeLiteral(Type definedType)
definedType
- the defined type.public TypeLiteral()
public static <R> TypeLiteral<R> of(Type type)
R
- the literal generic type.type
- the type , not null.public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType)
clazz
- the class to check, not null.interfaceType
- the interface type to be checked, not null.public static Type[] getTypeParameters(Type type)
type
- the type, not null.public final Type getType()
public final Class<T> getRawType()
Copyright © 2014–2016 Apache Software Foundation. All rights reserved.