public final class $Gson$Types
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
$Gson$Types.GenericArrayTypeImpl |
private static class |
$Gson$Types.ParameterizedTypeImpl |
private static class |
$Gson$Types.WildcardTypeImpl
The WildcardType interface supports multiple upper bounds and multiple
lower bounds.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) static java.lang.reflect.Type[] |
EMPTY_TYPE_ARRAY |
| Modifier | Constructor and Description |
|---|---|
private |
$Gson$Types() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.reflect.GenericArrayType |
arrayOf(java.lang.reflect.Type componentType)
Returns an array type whose elements are all instances of
componentType. |
static java.lang.reflect.Type |
canonicalize(java.lang.reflect.Type type)
Returns a type that is functionally equal but not necessarily equal
according to
Object.equals(). |
(package private) static void |
checkNotPrimitive(java.lang.reflect.Type type) |
private static java.lang.Class<?> |
declaringClassOf(java.lang.reflect.TypeVariable<?> typeVariable)
Returns the declaring class of
typeVariable, or null if it was not declared by
a class. |
(package private) static boolean |
equal(java.lang.Object a,
java.lang.Object b) |
static boolean |
equals(java.lang.reflect.Type a,
java.lang.reflect.Type b)
Returns true if
a and b are equal. |
static java.lang.reflect.Type |
getArrayComponentType(java.lang.reflect.Type array)
Returns the component type of this array type.
|
static java.lang.reflect.Type |
getCollectionElementType(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType)
Returns the element type of this collection type.
|
(package private) static java.lang.reflect.Type |
getGenericSupertype(java.lang.reflect.Type context,
java.lang.Class<?> rawType,
java.lang.Class<?> toResolve)
Returns the generic supertype for
supertype. |
static java.lang.reflect.Type[] |
getMapKeyAndValueTypes(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType)
Returns a two element array containing this map's key and value types in
positions 0 and 1 respectively.
|
static java.lang.Class<?> |
getRawType(java.lang.reflect.Type type) |
(package private) static java.lang.reflect.Type |
getSupertype(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType,
java.lang.Class<?> supertype)
Returns the generic form of
supertype. |
(package private) static int |
hashCodeOrZero(java.lang.Object o) |
private static int |
indexOf(java.lang.Object[] array,
java.lang.Object toFind) |
static java.lang.reflect.ParameterizedType |
newParameterizedTypeWithOwner(java.lang.reflect.Type ownerType,
java.lang.reflect.Type rawType,
java.lang.reflect.Type... typeArguments)
Returns a new parameterized type, applying
typeArguments to
rawType and enclosed by ownerType. |
static java.lang.reflect.Type |
resolve(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType,
java.lang.reflect.Type toResolve) |
private static java.lang.reflect.Type |
resolve(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType,
java.lang.reflect.Type toResolve,
java.util.Collection<java.lang.reflect.TypeVariable> visitedTypeVariables) |
(package private) static java.lang.reflect.Type |
resolveTypeVariable(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType,
java.lang.reflect.TypeVariable<?> unknown) |
static java.lang.reflect.WildcardType |
subtypeOf(java.lang.reflect.Type bound)
Returns a type that represents an unknown type that extends
bound. |
static java.lang.reflect.WildcardType |
supertypeOf(java.lang.reflect.Type bound)
Returns a type that represents an unknown supertype of
bound. |
static java.lang.String |
typeToString(java.lang.reflect.Type type) |
public static java.lang.reflect.ParameterizedType newParameterizedTypeWithOwner(java.lang.reflect.Type ownerType,
java.lang.reflect.Type rawType,
java.lang.reflect.Type... typeArguments)
typeArguments to
rawType and enclosed by ownerType.serializable parameterized type.public static java.lang.reflect.GenericArrayType arrayOf(java.lang.reflect.Type componentType)
componentType.serializable generic array type.public static java.lang.reflect.WildcardType subtypeOf(java.lang.reflect.Type bound)
bound.
For example, if bound is CharSequence.class, this returns
? extends CharSequence. If bound is Object.class,
this returns ?, which is shorthand for ? extends Object.public static java.lang.reflect.WildcardType supertypeOf(java.lang.reflect.Type bound)
bound. For
example, if bound is String.class, this returns ?
super String.public static java.lang.reflect.Type canonicalize(java.lang.reflect.Type type)
Object.equals(). The returned
type is Serializable.public static java.lang.Class<?> getRawType(java.lang.reflect.Type type)
static boolean equal(java.lang.Object a,
java.lang.Object b)
public static boolean equals(java.lang.reflect.Type a,
java.lang.reflect.Type b)
a and b are equal.static int hashCodeOrZero(java.lang.Object o)
public static java.lang.String typeToString(java.lang.reflect.Type type)
static java.lang.reflect.Type getGenericSupertype(java.lang.reflect.Type context,
java.lang.Class<?> rawType,
java.lang.Class<?> toResolve)
supertype. For example, given a class IntegerSet, the result for when supertype is Set.class is Set<Integer> and the
result when the supertype is Collection.class is Collection<Integer>.static java.lang.reflect.Type getSupertype(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType,
java.lang.Class<?> supertype)
supertype. For example, if this is ArrayList<String>, this returns Iterable<String> given the input Iterable.class.supertype - a superclass of, or interface implemented by, this.public static java.lang.reflect.Type getArrayComponentType(java.lang.reflect.Type array)
java.lang.ClassCastException - if this type is not an array.public static java.lang.reflect.Type getCollectionElementType(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType)
java.lang.IllegalArgumentException - if this type is not a collection.public static java.lang.reflect.Type[] getMapKeyAndValueTypes(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType)
public static java.lang.reflect.Type resolve(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType,
java.lang.reflect.Type toResolve)
private static java.lang.reflect.Type resolve(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType,
java.lang.reflect.Type toResolve,
java.util.Collection<java.lang.reflect.TypeVariable> visitedTypeVariables)
static java.lang.reflect.Type resolveTypeVariable(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType,
java.lang.reflect.TypeVariable<?> unknown)
private static int indexOf(java.lang.Object[] array,
java.lang.Object toFind)
private static java.lang.Class<?> declaringClassOf(java.lang.reflect.TypeVariable<?> typeVariable)
typeVariable, or null if it was not declared by
a class.static void checkNotPrimitive(java.lang.reflect.Type type)