Util

class Util

Types

GenericArrayTypeImpl
Link copied to clipboard
class GenericArrayTypeImpl : GenericArrayType
ParameterizedTypeImpl
Link copied to clipboard
class ParameterizedTypeImpl : ParameterizedType
WildcardTypeImpl
Link copied to clipboard
class WildcardTypeImpl : WildcardType
The WildcardType interface supports multiple upper bounds and multiple lower bounds.

Functions

boxIfPrimitive
Link copied to clipboard
open fun <T> boxIfPrimitive(type: Class<T>): Class<T>
canonicalize
Link copied to clipboard
open fun canonicalize(type: Type): Type
Returns a type that is functionally equal but not necessarily equal according to Object.equals().
generatedAdapter
Link copied to clipboard
open fun generatedAdapter(moshi: Moshi, type: Type, rawType: Class<out Any>): JsonAdapter<out Any>
Loads the generated JsonAdapter for classes annotated JsonClass.
getGenericSupertype
Link copied to clipboard
open fun getGenericSupertype(context: Type, rawType: Class<out Any>, toResolve: Class<out Any>): Type
Returns the generic supertype for {@code supertype}.
hasNullable
Link copied to clipboard
open fun hasNullable(annotations: Array<Annotation>): Boolean
Returns true if {@code annotations} has any annotation whose simple name is Nullable.
isAnnotationPresent
Link copied to clipboard
open fun isAnnotationPresent(annotations: Set<out Annotation>, annotationClass: Class<out Annotation>): Boolean
isKotlin
Link copied to clipboard
open fun isKotlin(targetClass: Class<out Any>): Boolean
isPlatformType
Link copied to clipboard
open fun isPlatformType(rawType: Class<out Any>): Boolean
Returns true if {@code rawType} is built in.
jsonAnnotations
Link copied to clipboard
open fun jsonAnnotations(annotations: Array<Annotation>): Set<out Annotation>
open fun jsonAnnotations(annotatedElement: AnnotatedElement): Set<out Annotation>
lookupDefaultsConstructor
Link copied to clipboard
open fun <T> lookupDefaultsConstructor(targetClass: Class<T>): Constructor<T>
Reflectively looks up the defaults constructor of a kotlin class.
missingProperty
Link copied to clipboard
open fun missingProperty(propertyName: String, jsonName: String, reader: JsonReader): JsonDataException
removeSubtypeWildcard
Link copied to clipboard
open fun removeSubtypeWildcard(type: Type): Type
If type is a "?
resolve
Link copied to clipboard
open fun resolve(context: Type, contextRawType: Class<out Any>, toResolve: Type): Type
rethrowCause
Link copied to clipboard
open fun rethrowCause(e: InvocationTargetException): RuntimeException
Throws the cause of {@code e}, wrapping it if it is checked.
typeAnnotatedWithAnnotations
Link copied to clipboard
open fun typeAnnotatedWithAnnotations(type: Type, annotations: Set<out Annotation>): String
typesMatch
Link copied to clipboard
open fun typesMatch(pattern: Type, candidate: Type): Boolean
unexpectedNull
Link copied to clipboard
open fun unexpectedNull(propertyName: String, jsonName: String, reader: JsonReader): JsonDataException

Properties

DEFAULT_CONSTRUCTOR_MARKER
Link copied to clipboard
val DEFAULT_CONSTRUCTOR_MARKER: Class<out Any>
EMPTY_TYPE_ARRAY
Link copied to clipboard
val EMPTY_TYPE_ARRAY: Array<Type>
NO_ANNOTATIONS
Link copied to clipboard
val NO_ANNOTATIONS: Set<Annotation>