改造2.3.0 CallAdapter.Factory

时间:2017-11-30 17:22:34

标签: android retrofit

我有一个基础APIResult,用于检查API返回的某些数据。我正在尝试创建一个CustomCall对象,它将在API被触发时检查此数据,但我对如何执行此操作感到困惑。这就是我所拥有的:

@Nullable
@Override
public CallAdapter<?, ?> get(@NonNull final Type returnType,
                             @NonNull final Annotation[] annotations,
                             @NonNull final Retrofit retrofit) {
    final Type responseType = getParameterUpperBound(0, (ParameterizedType) returnType);

    return new CallAdapter<Object, CustomCall<? extends APIResult>>() { // Is this correct?!

        @Override
        public Type responseType() {
            return responseType;
        }

        @Override
        public CustomCall<? extends APIResult> adapt(@NonNull Call<Object> call) {
            // How/what do I return here exactly?
        }
    };
}

0 个答案:

没有答案