public interface APIRequestFuture<T>
Modifier and Type | Method and Description |
---|---|
T |
awaitResponse()
Stops the current thread to wait for a response and returns it when it arrived
|
APIRequest<T> |
getAPIRequest() |
APIRequestError |
getError() |
java.util.Collection<APIRequestErrorHandler> |
getErrorHandlers() |
java.util.Collection<APIRequestFutureListener<T>> |
getListeners() |
T |
getResponse() |
boolean |
isCompleted() |
java.lang.Boolean |
isSuccess() |
APIRequestFuture<T> |
onCompletion(APIRequestFutureListenerWithoutParams<T> listener) |
APIRequestFuture<T> |
onCompletion(APIRequestFutureListenerWithParams<T> listener) |
APIRequestFuture<T> |
onError(APIRequestErrorHandler handler) |
APIRequestFuture<T> |
removeErrorHandler(APIRequestErrorHandler errorHandler) |
APIRequestFuture<T> |
removeListener(APIRequestFutureListener<T> listener) |
APIRequestFuture<T> onCompletion(APIRequestFutureListenerWithoutParams<T> listener)
listener
- Will be called if the APIRequest was successful and a response arrivedAPIRequestFuture<T> onCompletion(APIRequestFutureListenerWithParams<T> listener)
listener
- Will be called if the APIRequest was successful and a response arrivedAPIRequestFuture<T> onError(APIRequestErrorHandler handler)
handler
- Will be called when an error is returned because of an invalid requestboolean isCompleted()
java.lang.Boolean isSuccess()
APIRequest<T> getAPIRequest()
T getResponse()
APIRequestError getError()
T awaitResponse() throws APIRequestError
APIRequestError
- An APIRequestError might be thrown if the API request is not validAPIRequestFuture<T> removeListener(APIRequestFutureListener<T> listener)
listener
- The given listener will not be notified about the APIRequest's responseAPIRequestFuture<T> removeErrorHandler(APIRequestErrorHandler errorHandler)
errorHandler
- The given error handler will not be notified about an error returned to the APIRequestjava.util.Collection<APIRequestFutureListener<T>> getListeners()
java.util.Collection<APIRequestErrorHandler> getErrorHandlers()