public final class GsonConverterFactory extends Converter.Factory
Because Gson is so flexible in the types it supports, this converter assumes that it can handle all types. If you are mixing JSON serialization with something else (such as protocol buffers), you must add this instance last to allow the other converters a chance to see their types.
Modifier and Type | Method and Description |
---|---|
static GsonConverterFactory |
create()
Create an instance using a default
Gson instance for conversion. |
static GsonConverterFactory |
create(com.google.gson.Gson gson)
Create an instance using
gson for conversion. |
Converter<?,okhttp3.RequestBody> |
requestBodyConverter(Type type,
Annotation[] parameterAnnotations,
Annotation[] methodAnnotations,
Retrofit retrofit) |
Converter<okhttp3.ResponseBody,?> |
responseBodyConverter(Type type,
Annotation[] annotations,
Retrofit retrofit) |
getParameterUpperBound, getRawType, stringConverter
public static GsonConverterFactory create()
Gson
instance for conversion. Encoding to JSON and
decoding from JSON (when no charset is specified by a header) will use UTF-8.public static GsonConverterFactory create(com.google.gson.Gson gson)
gson
for conversion. Encoding to JSON and
decoding from JSON (when no charset is specified by a header) will use UTF-8.public Converter<okhttp3.ResponseBody,?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit)
responseBodyConverter
in class Converter.Factory
public Converter<?,okhttp3.RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit)
requestBodyConverter
in class Converter.Factory
Copyright © 2020 Square, Inc.. All rights reserved.