$Gson$Types

class $Gson$Types

Static methods for working with types.

Author

Bob Lee

Jesse Wilson

Functions

arrayOf
Link copied to clipboard
open fun arrayOf(componentType: Type): GenericArrayType
Returns an array type whose elements are all instances of {@code componentType}.
canonicalize
Link copied to clipboard
open fun canonicalize(type: Type): Type
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
Returns true if {@code a} and {@code b} are equal.
getArrayComponentType
Link copied to clipboard
open fun getArrayComponentType(array: Type): Type
Returns the component type of this array type.
getCollectionElementType
Link copied to clipboard
open fun getCollectionElementType(context: Type, contextRawType: Class<out Any>): Type
Returns the element type of this collection type.
getMapKeyAndValueTypes
Link copied to clipboard
open fun getMapKeyAndValueTypes(context: Type, contextRawType: Class<out Any>): Array<Type>
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>
newParameterizedTypeWithOwner
Link copied to clipboard
open fun newParameterizedTypeWithOwner(ownerType: Type, rawType: Type, typeArguments: Array<Type>): ParameterizedType
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
subtypeOf
Link copied to clipboard
open fun subtypeOf(bound: Type): WildcardType
Returns a type that represents an unknown type that extends {@code bound}.
supertypeOf
Link copied to clipboard
open fun supertypeOf(bound: Type): WildcardType
Returns a type that represents an unknown supertype of {@code bound}.
typeToString
Link copied to clipboard
open fun typeToString(type: Type): String