本文整理了Java中retrofit2.Retrofit.nextResponseBodyConverter
方法的一些代码示例,展示了Retrofit.nextResponseBodyConverter
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Retrofit.nextResponseBodyConverter
方法的具体详情如下:
包路径:retrofit2.Retrofit
类名称:Retrofit
方法名:nextResponseBodyConverter
[英]Returns a Converter for ResponseBody to type from the available #converterFactories() except skipPast.
[中]从可用的#ConverterFactorys()中返回ResponseBody要键入的转换器,SkippCast除外。
代码示例来源:origin: square/retrofit
/**
* Returns a {@link Converter} for {@link ResponseBody} to {@code type} from the available
* {@linkplain #converterFactories() factories}.
*
* @throws IllegalArgumentException if no converter available for {@code type}.
*/
public <T> Converter<ResponseBody, T> responseBodyConverter(Type type, Annotation[] annotations) {
return nextResponseBodyConverter(null, type, annotations);
}
代码示例来源:origin: com.squareup.retrofit2/retrofit
/**
* Returns a {@link Converter} for {@link ResponseBody} to {@code type} from the available
* {@linkplain #converterFactories() factories}.
*
* @throws IllegalArgumentException if no converter available for {@code type}.
*/
public <T> Converter<ResponseBody, T> responseBodyConverter(Type type, Annotation[] annotations) {
return nextResponseBodyConverter(null, type, annotations);
}
代码示例来源:origin: uber/rave
@Override
public Converter<ResponseBody, ?> responseBodyConverter(
Type type, Annotation[] annotations, Retrofit retrofit) {
Converter<ResponseBody, ?> delegateConverter = retrofit.nextResponseBodyConverter(this, type, annotations);
return new RaveResponseConverter(delegateConverter);
}
代码示例来源:origin: leonardoxh/livedata-call-adapter
@Nullable
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations,
Retrofit retrofit) {
if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) type;
if (parameterizedType.getRawType() == Response.class) {
Type subType = parameterizedType.getActualTypeArguments()[0];
if (subType instanceof ParameterizedType) {
parameterizedType = (ParameterizedType) parameterizedType.getActualTypeArguments()[0];
}
}
if (parameterizedType.getRawType() == Resource.class) {
Type realType = parameterizedType.getActualTypeArguments()[0];
return retrofit.nextResponseBodyConverter(this, realType, annotations);
}
}
return retrofit.nextResponseBodyConverter(this, type, annotations);
}
}
代码示例来源:origin: ZacSweers/inspector
@Override public Converter<ResponseBody, ?> responseBodyConverter(Type type,
Annotation[] annotations,
Retrofit retrofit) {
Converter<ResponseBody, ?> delegateConverter =
retrofit.nextResponseBodyConverter(this, type, annotations);
return new InspectorResponseConverter(type, inspector, callback, delegateConverter);
}
代码示例来源:origin: segmentio/retrofit-jsonrpc
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type,
Annotation[] annotations,
Retrofit retrofit) {
if (!Utils.isAnnotationPresent(annotations, JsonRPC.class)) {
return null;
}
Type rpcType = Types.newParameterizedType(JsonRPCResponse.class, type);
Converter<ResponseBody, JsonRPCResponse> delegate =
retrofit.nextResponseBodyConverter(this, rpcType, annotations);
//noinspection unchecked
return new JsonRPCResponseBodyConverter(delegate);
}
内容来源于网络,如有侵权,请联系作者删除!