public class ResponseHandler<T>
extends java.lang.Object
| Constructor and Description |
|---|
ResponseHandler(com.google.gson.reflect.TypeToken<T> type)
"Generics on a type are typically erased at runtime, except when the type is compiled with the
generic parameter bound.
|
| Modifier and Type | Method and Description |
|---|---|
T |
handleResponse(okhttp3.Response response)
Handles the HTTP response and converts it to the appropriate object or throws exceptions based
on the response status.
|
T |
handleResponse(okhttp3.Response response,
boolean submitTransactionAsync)
Handles the HTTP response and converts it to the appropriate object or throws exceptions based
on the response status.
|
public ResponseHandler(com.google.gson.reflect.TypeToken<T> type)
type - public T handleResponse(okhttp3.Response response)
response - The HTTP response to handleTooManyRequestsException - If the response code is 429 (Too Many Requests)UnexpectedException - If the response body is empty or there's an unexpected error
reading the responseBadRequestException - If the response code is in the 4xx rangeBadResponseException - If the response code is in the 5xx rangepublic T handleResponse(okhttp3.Response response, boolean submitTransactionAsync)
response - The HTTP response to handlesubmitTransactionAsync - Only set it to true when calling Server.submitTransactionXdrAsync(String).TooManyRequestsException - If the response code is 429 (Too Many Requests)UnexpectedException - If the response body is empty or there's an unexpected error
reading the responseBadRequestException - If the response code is in the 4xx rangeBadResponseException - If the response code is in the 5xx range