本文整理了Java中retrofit2.Retrofit.nextCallAdapter
方法的一些代码示例,展示了Retrofit.nextCallAdapter
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Retrofit.nextCallAdapter
方法的具体详情如下:
包路径:retrofit2.Retrofit
类名称:Retrofit
方法名:nextCallAdapter
[英]Returns the CallAdapter for returnType from the available #callAdapterFactories() except skipPast.
[中]从可用的#CallAdapterFactorys()中返回returnType的CallAdapter,skipPast除外。
代码示例来源:origin: square/retrofit
/**
* Returns the {@link CallAdapter} for {@code returnType} from the available {@linkplain
* #callAdapterFactories() factories}.
*
* @throws IllegalArgumentException if no call adapter available for {@code type}.
*/
public CallAdapter<?, ?> callAdapter(Type returnType, Annotation[] annotations) {
return nextCallAdapter(null, returnType, annotations);
}
代码示例来源:origin: com.squareup.retrofit2/retrofit
/**
* Returns the {@link CallAdapter} for {@code returnType} from the available {@linkplain
* #callAdapterFactories() factories}.
*
* @throws IllegalArgumentException if no call adapter available for {@code type}.
*/
public CallAdapter<?, ?> callAdapter(Type returnType, Annotation[] annotations) {
return nextCallAdapter(null, returnType, annotations);
}
代码示例来源:origin: square/retrofit
@Override public @Nullable CallAdapter<?, ?> get(
Type returnType, Annotation[] annotations, Retrofit retrofit) {
if (getRawType(returnType) != Observable.class) {
return null; // Ignore non-Observable types.
}
// Look up the next call adapter which would otherwise be used if this one was not present.
//noinspection unchecked returnType checked above to be Observable.
final CallAdapter<Object, Observable<?>> delegate =
(CallAdapter<Object, Observable<?>>) retrofit.nextCallAdapter(this, returnType,
annotations);
return new CallAdapter<Object, Object>() {
@Override public Object adapt(Call<Object> call) {
// Delegate to get the normal Observable...
Observable<?> o = delegate.adapt(call);
// ...and change it to send notifications to the observer on the specified scheduler.
return o.observeOn(scheduler);
}
@Override public Type responseType() {
return delegate.responseType();
}
};
}
}
代码示例来源:origin: NightlyNexus/logging-retrofit
@Override
public CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) {
CallAdapter<?, ?> delegate = retrofit.nextCallAdapter(this, returnType, annotations);
return new LoggingCallAdapter<>(delegate, logger);
}
内容来源于网络,如有侵权,请联系作者删除!