# $Gson$Types

class $Gson$Types
Content copied to clipboard

Static methods for working with types.

#### Author

Bob Lee

Jesse Wilson

## Functions

arrayOf
Link copied to clipboard
open fun arrayOf(componentType: Type): GenericArrayType
Content copied to clipboard
Returns an array type whose elements are all instances of `{@code componentType}`.
canonicalize
Link copied to clipboard
open fun canonicalize(type: Type): Type
Content copied to clipboard
Returns a type that is functionally equal but not necessarily equalaccording to Object.equals().
equals
Link copied to clipboard
open fun equals(a: Type, b: Type): Boolean
Content copied to clipboard
Returns true if `{@code a}` and `{@code b}` are equal.
getArrayComponentType
Link copied to clipboard
open fun getArrayComponentType(array: Type): Type
Content copied to clipboard
Returns the component type of this array type.
getCollectionElementType
Link copied to clipboard
open fun getCollectionElementType(context: Type, contextRawType: Class<out Any>): Type
Content copied to clipboard
Returns the element type of this collection type.
getMapKeyAndValueTypes
Link copied to clipboard
open fun getMapKeyAndValueTypes(context: Type, contextRawType: Class<out Any>): Array<Type>
Content copied to clipboard
Returns a two element array containing this map's key and value types inpositions 0 and 1 respectively.
getRawType
Link copied to clipboard
open fun getRawType(type: Type): Class<out Any>
Content copied to clipboard
newParameterizedTypeWithOwner
Link copied to clipboard
open fun newParameterizedTypeWithOwner(ownerType: Type, rawType: Type, typeArguments: Array<Type>): ParameterizedType
Content copied to clipboard
Returns a new parameterized type, applying `{@code typeArguments}` to `{@code rawType}` and enclosed by `{@code ownerType}`.
resolve
Link copied to clipboard
open fun resolve(context: Type, contextRawType: Class<out Any>, toResolve: Type): Type
Content copied to clipboard
subtypeOf
Link copied to clipboard
open fun subtypeOf(bound: Type): WildcardType
Content copied to clipboard
Returns a type that represents an unknown type that extends `{@code bound}`.
supertypeOf
Link copied to clipboard
open fun supertypeOf(bound: Type): WildcardType
Content copied to clipboard
Returns a type that represents an unknown supertype of `{@code bound}`.
typeToString
Link copied to clipboard
open fun typeToString(type: Type): String
Content copied to clipboard