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