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
ConstructorsModifierConstructorDescriptionprotectedConstructs a type token.privateTypeToken(AnnotatedType type) -
Method Summary
Modifier and TypeMethodDescriptionbooleanprivate AnnotatedTypestatic <T> TypeToken<T> Gets type token for the givenClassinstance.static TypeToken<?> Gets type token for the givenTypeinstance.getType()inthashCode()
-
Field Details
-
type
-
canonical
-
-
Constructor Details
-
TypeToken
protected TypeToken()Constructs a type token. -
TypeToken
-
-
Method Details
-
get
Gets type token for the givenClassinstance.- 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 givenTypeinstance.- 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()
-