public abstract static class Converter.Factory extends Object
Converter instances based on a type and target usage.| Constructor and Description |
|---|
Factory() |
| Modifier and Type | Method and Description |
|---|---|
protected static Type |
getParameterUpperBound(int index,
ParameterizedType type)
Extract the upper bound of the generic parameter at
index from type. |
protected static Class<?> |
getRawType(Type type)
Extract the raw class type from
type. |
Converter<?,okhttp3.RequestBody> |
requestBodyConverter(Type type,
Annotation[] parameterAnnotations,
Annotation[] methodAnnotations,
Retrofit retrofit)
Returns a
Converter for converting type to an HTTP request body, or null if
type cannot be handled by this factory. |
Converter<okhttp3.ResponseBody,?> |
responseBodyConverter(Type type,
Annotation[] annotations,
Retrofit retrofit)
Returns a
Converter for converting an HTTP response body to type, or null if
type cannot be handled by this factory. |
Converter<?,String> |
stringConverter(Type type,
Annotation[] annotations,
Retrofit retrofit)
|
@Nullable public Converter<okhttp3.ResponseBody,?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit)
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.@Nullable public Converter<?,okhttp3.RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit)
@Nullable public Converter<?,String> stringConverter(Type type, Annotation[] annotations, Retrofit retrofit)
protected static Type getParameterUpperBound(int index, ParameterizedType type)
index from type. For
example, index 1 of Map<String, ? extends Runnable> returns Runnable.Copyright © 2017 Square, Inc.. All rights reserved.