Uses of Class
com.google.gson.reflect.TypeToken
-
Packages that use TypeToken Package Description com.google.gson This package provides theGson
class to convert Json to Java and vice-versa.com.google.gson.reflect This package provides utility classes for finding type information for generic types. -
-
Uses of TypeToken in com.google.gson
Methods in com.google.gson with parameters of type TypeToken Modifier and Type Method Description <T> TypeAdapter<T>
TypeAdapterFactory. create(Gson gson, TypeToken<T> type)
Returns a type adapter fortype
, or null if this factory doesn't supporttype
.<T> T
Gson. fromJson(JsonElement json, TypeToken<T> typeOfT)
This method deserializes the JSON read from the specified parse tree into an object of the specified type.<T> T
Gson. fromJson(JsonReader reader, TypeToken<T> typeOfT)
Reads the next JSON value fromreader
and converts it to an object of typetypeOfT
.<T> T
Gson. fromJson(Reader json, TypeToken<T> typeOfT)
This method deserializes the JSON read from the specified reader into an object of the specified type.<T> T
Gson. fromJson(String json, TypeToken<T> typeOfT)
This method deserializes the specified JSON into an object of the specified type.<T> TypeAdapter<T>
Gson. getAdapter(TypeToken<T> type)
Returns the type adapter fortype
.<T> TypeAdapter<T>
Gson. getDelegateAdapter(TypeAdapterFactory skipPast, TypeToken<T> type)
This method is used to get an alternate type adapter for the specified type. -
Uses of TypeToken in com.google.gson.reflect
Methods in com.google.gson.reflect that return TypeToken Modifier and Type Method Description static <T> TypeToken<T>
TypeToken. get(Class<T> type)
Gets type literal for the givenClass
instance.static TypeToken<?>
TypeToken. get(Type type)
Gets type literal for the givenType
instance.static TypeToken<?>
TypeToken. getArray(Type componentType)
Gets type literal for the array type whose elements are all instances ofcomponentType
.static TypeToken<?>
TypeToken. getParameterized(Type rawType, Type... typeArguments)
Gets a type literal for the parameterized type represented by applyingtypeArguments
torawType
.Methods in com.google.gson.reflect with parameters of type TypeToken Modifier and Type Method Description boolean
TypeToken. isAssignableFrom(TypeToken<?> token)
Deprecated.this implementation may be inconsistent with javac for types with wildcards.
-