retrofit2.Retrofit.callbackExecutor()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(243)

本文整理了Java中retrofit2.Retrofit.callbackExecutor方法的一些代码示例,展示了Retrofit.callbackExecutor的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Retrofit.callbackExecutor方法的具体详情如下:
包路径:retrofit2.Retrofit
类名称:Retrofit
方法名:callbackExecutor

Retrofit.callbackExecutor介绍

[英]The executor used for Callback methods on a Call. This may be null, in which case callbacks should be made synchronously on the background thread.
[中]用于调用回调方法的执行器。这可能是空的,在这种情况下,回调应该在后台线程上同步进行。

代码示例

代码示例来源:origin: square/retrofit

@Override public @Nullable CallAdapter<?, ?> get(
  Type returnType, Annotation[] annotations, Retrofit retrofit) {
 if (getRawType(returnType) != MyCall.class) {
  return null;
 }
 if (!(returnType instanceof ParameterizedType)) {
  throw new IllegalStateException(
    "MyCall must have generic type (e.g., MyCall<ResponseBody>)");
 }
 Type responseType = getParameterUpperBound(0, (ParameterizedType) returnType);
 Executor callbackExecutor = retrofit.callbackExecutor();
 return new ErrorHandlingCallAdapter<>(responseType, callbackExecutor);
}

代码示例来源:origin: com.microsoft.rest/client-runtime

this.credentials = restClient.builder.credentials;
if (restClient.retrofit.callbackExecutor() != null) {
  this.withCallbackExecutor(restClient.retrofit.callbackExecutor());

相关文章