T
- The type represented by this TypeToken.public abstract class TypeToken<T>
extends java.lang.Object
Type
.
You can use this to create instances of Type for a type known at compile
time.
For example, to get the Type that represents List<String>:
Type listOfString = new TypeToken<List<String>>(){}.getType();
Modifier | Constructor and Description |
---|---|
protected |
TypeToken()
Constructs a type token.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
static <T> TypeToken<T> |
get(java.lang.Class<T> type)
Gets type token for the given
Class instance. |
static TypeToken<?> |
get(java.lang.reflect.Type type)
Gets type token for the given
Type instance. |
java.lang.reflect.Type |
getType() |
int |
hashCode() |
public java.lang.reflect.Type getType()
public static <T> TypeToken<T> get(java.lang.Class<T> type)
Class
instance.public static TypeToken<?> get(java.lang.reflect.Type type)
Type
instance.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2016. All rights reserved