类 OkHttpPendingResult<T,R extends ApiResponse<T>>
java.lang.Object
ai.nextbillion.maps.internal.OkHttpPendingResult<T,R>
- 所有已实现的接口:
PendingResult<T>,okhttp3.Callback
public class OkHttpPendingResult<T,R extends ApiResponse<T>> extends java.lang.Object implements PendingResult<T>, okhttp3.Callback
A PendingResult backed by a HTTP call executed by OkHttp, a deserialization step using Gson, rate
limiting and a retry policy.
T is the type of the result of this pending result, and R is the type of the
request.
-
嵌套类概要
-
构造器概要
构造器 构造器 说明 OkHttpPendingResult(okhttp3.Request request, okhttp3.OkHttpClient client, java.lang.Class<R> responseClass, com.google.gson.FieldNamingPolicy fieldNamingPolicy, long errorTimeOut, java.lang.Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry, RequestMetrics metrics) -
方法概要
修饰符和类型 方法 说明 Tawait()Performs the request synchronously.TawaitIgnoreError()Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.voidcancel()Attempts to cancel the request.voidonFailure(okhttp3.Call call, java.io.IOException ioe)voidonResponse(okhttp3.Call call, okhttp3.Response response)voidsetCallback(PendingResult.Callback<T> callback)
-
构造器详细资料
-
OkHttpPendingResult
public OkHttpPendingResult(okhttp3.Request request, okhttp3.OkHttpClient client, java.lang.Class<R> responseClass, com.google.gson.FieldNamingPolicy fieldNamingPolicy, long errorTimeOut, java.lang.Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry, RequestMetrics metrics)- 参数:
request- HTTP request to execute.client- The client used to execute the request.responseClass- Model class to unmarshal JSON body content.fieldNamingPolicy- FieldNamingPolicy for unmarshaling JSON.errorTimeOut- Number of milliseconds to re-send erroring requests.maxRetries- Number of times allowed to re-send erroring requests.exceptionsAllowedToRetry- The exceptions to retry.metrics- metrics
-
-
方法详细资料
-
setCallback
从接口复制的说明:PendingResultPerforms the request asynchronously, callingonResultoronFailureafter the request has been completed.- 指定者:
setCallback在接口中PendingResult<T>- 参数:
callback- The callback to call on completion.
-
await
从接口复制的说明:PendingResultPerforms the request synchronously.- 指定者:
await在接口中PendingResult<T>- 返回:
- The result.
- 抛出:
ApiException- Thrown if the API Returned result is an error.java.io.IOException- Thrown when an I/O exception of some sort has occurred.java.lang.InterruptedException- Thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted.
-
awaitIgnoreError
从接口复制的说明:PendingResultPerforms the request synchronously, ignoring exceptions while performing the request and errors returned by the server.- 指定者:
awaitIgnoreError在接口中PendingResult<T>- 返回:
- The result, or null if there was any error or exception ignored.
-
cancel
public void cancel()从接口复制的说明:PendingResultAttempts to cancel the request.- 指定者:
cancel在接口中PendingResult<T>
-
onFailure
public void onFailure(okhttp3.Call call, java.io.IOException ioe)- 指定者:
onFailure在接口中okhttp3.Callback
-
onResponse
public void onResponse(okhttp3.Call call, okhttp3.Response response) throws java.io.IOException- 指定者:
onResponse在接口中okhttp3.Callback- 抛出:
java.io.IOException
-