T - public abstract class TypeLiteral<T>
extends java.lang.Object
TypeLiteral.
TypeLiteral<List<String>> stringListType = new TypeLiteral<List<String>>() {};
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Class<T> |
rawType
Store the actual raw parameter type.
|
private java.lang.reflect.Type |
type
Store the actual type (direct subclass of TypeLiteral).
|
| Modifier | Constructor and Description |
|---|---|
protected |
TypeLiteral() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.reflect.Type[] |
getParameterTypes()
Gets the types associated with this literal
|
java.lang.Class<T> |
getRawType() |
static java.lang.Class<?> |
getRawType(java.lang.reflect.Type type)
Gets the base associated class from this type
|
java.lang.reflect.Type |
getType() |
private static java.lang.Class<?> |
getTypeLiteralSubclass(java.lang.Class<?> clazz)
Return the direct child class that extends TypeLiteral
|
private static java.lang.reflect.Type |
getTypeParameter(java.lang.Class<?> typeLiteralSubclass)
Return the value of the type parameter of TypeLiteral
|
int |
hashCode() |
java.lang.String |
toString() |
private transient java.lang.reflect.Type type
private transient java.lang.Class<T> rawType
public final java.lang.reflect.Type getType()
public final java.lang.reflect.Type[] getParameterTypes()
public final java.lang.Class<T> getRawType()
public static java.lang.Class<?> getRawType(java.lang.reflect.Type type)
type - The non-null type to analyzeprivate static java.lang.Class<?> getTypeLiteralSubclass(java.lang.Class<?> clazz)
clazz - processed classprivate static java.lang.reflect.Type getTypeParameter(java.lang.Class<?> typeLiteralSubclass)
typeLiteralSubclass - subClass of TypeLiteralpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object