|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.gson.internal.$Gson$Types
public final class $Gson$Types
Static methods for working with types.
Method Summary | |
---|---|
static GenericArrayType |
arrayOf(Type componentType)
Returns an array type whose elements are all instances of componentType . |
static Type |
canonicalize(Type type)
Returns a type that is functionally equal but not necessarily equal according to Object.equals() . |
static boolean |
equals(Type a,
Type b)
Returns true if a and b are equal. |
static Type |
getArrayComponentType(Type array)
Returns the component type of this array type. |
static Type |
getCollectionElementType(Type context,
Class<?> contextRawType)
Returns the element type of this collection type. |
static Type[] |
getMapKeyAndValueTypes(Type context,
Class<?> contextRawType)
Returns a two element array containing this map's key and value types in positions 0 and 1 respectively. |
static Class<?> |
getRawType(Type type)
|
static boolean |
isArray(Type type)
Returns true if this type is an array. |
static ParameterizedType |
newParameterizedTypeWithOwner(Type ownerType,
Type rawType,
Type... typeArguments)
Returns a new parameterized type, applying typeArguments to
rawType and enclosed by ownerType . |
static Type |
resolve(Type context,
Class<?> contextRawType,
Type toResolve)
|
static WildcardType |
subtypeOf(Type bound)
Returns a type that represents an unknown type that extends bound . |
static WildcardType |
supertypeOf(Type bound)
Returns a type that represents an unknown supertype of bound . |
static String |
typeToString(Type type)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ParameterizedType newParameterizedTypeWithOwner(Type ownerType, Type rawType, Type... typeArguments)
typeArguments
to
rawType
and enclosed by ownerType
.
serializable
parameterized type.public static GenericArrayType arrayOf(Type componentType)
componentType
.
serializable
generic array type.public static WildcardType subtypeOf(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 WildcardType supertypeOf(Type bound)
bound
. For
example, if bound
is String.class
, this returns ?
super String
.
public static Type canonicalize(Type type)
Object.equals()
. The returned
type is Serializable
.
public static Class<?> getRawType(Type type)
public static boolean equals(Type a, Type b)
a
and b
are equal.
public static String typeToString(Type type)
public static boolean isArray(Type type)
public static Type getArrayComponentType(Type array)
ClassCastException
- if this type is not an array.public static Type getCollectionElementType(Type context, Class<?> contextRawType)
IllegalArgumentException
- if this type is not a collection.public static Type[] getMapKeyAndValueTypes(Type context, Class<?> contextRawType)
public static Type resolve(Type context, Class<?> contextRawType, Type toResolve)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |