java.lang.Object
io.leangen.geantyref.TypeToken<T>
- Type Parameters:
T
- The type represented by this TypeToken.
Wrapper around
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();
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructs a type token.private
TypeToken
(AnnotatedType type) -
Method Summary
Modifier and TypeMethodDescriptionboolean
private AnnotatedType
static <T> TypeToken
<T> Gets type token for the givenClass
instance.static TypeToken
<?> Gets type token for the givenType
instance.getType()
int
hashCode()
-
Field Details
-
type
-
canonical
-
-
Constructor Details
-
TypeToken
protected TypeToken()Constructs a type token. -
TypeToken
-
-
Method Details
-
get
Gets type token for the givenClass
instance.- Type Parameters:
T
- The generic type captured by the token- Parameters:
type
- The class from which the token is created- Returns:
- TypeToken corresponding to the provided class
-
get
Gets type token for the givenType
instance.- Parameters:
type
- The type from which the token is created- Returns:
- TypeToken corresponding to the provided type
-
getType
-
getAnnotatedType
-
getCanonicalType
-
extractType
-
equals
-
hashCode
public int hashCode()
-