retrofit / retrofit2 / Converter / Factory

Factory

abstract class Factory

Creates Converter instances based on a type and target usage.

Constructors

<init>

Factory()

Creates Converter instances based on a type and target usage.

Functions

getParameterUpperBound

open static fun getParameterUpperBound(index: Int, type: ParameterizedType!): Type!

Extract the upper bound of the generic parameter at index from type. For example, index 1 of Map<String, ? extends Runnable> returns Runnable.

getRawType

open static fun getRawType(type: Type!): Class<*>!

Extract the raw class type from type. For example, the type representing List<? extends Runnable> returns List.class.

requestBodyConverter

open fun requestBodyConverter(type: Type!, parameterAnnotations: Array<Annotation!>!, methodAnnotations: Array<Annotation!>!, retrofit: Retrofit!): Converter<*, RequestBody!>?

Returns a Converter for converting type to an HTTP request body, or null if type cannot be handled by this factory. This is used to create converters for types specified by @Body, @Part, and @PartMap values.

responseBodyConverter

open fun responseBodyConverter(type: Type!, annotations: Array<Annotation!>!, retrofit: Retrofit!): Converter<ResponseBody!, *>?

Returns a Converter for converting an HTTP response body to type, or null if type cannot be handled by this factory. This is used to create converters for response types such as SimpleResponse from a Call<SimpleResponse> declaration.

stringConverter

open fun stringConverter(type: Type!, annotations: Array<Annotation!>!, retrofit: Retrofit!): Converter<*, String!>?

Returns a Converter for converting type to a String, or null if type cannot be handled by this factory. This is used to create converters for types specified by @Field, @FieldMap values, @Header, @HeaderMap, @Path, @Query, and values.