public interface ActionListener<Response>
Modifier and Type | Method and Description |
---|---|
void |
onFailure(java.lang.Exception e)
A failure caused by an exception at some phase of the task.
|
static <Response> void |
onFailure(java.lang.Iterable<ActionListener<Response>> listeners,
java.lang.Exception failure)
Notifies every given listener with the failure passed to
onFailure(Exception) . |
static <Response> void |
onResponse(java.lang.Iterable<ActionListener<Response>> listeners,
Response response)
Notifies every given listener with the response passed to
onResponse(Object) . |
void |
onResponse(Response response)
Handle action response.
|
static <Response> ActionListener<Response> |
wrap(CheckedConsumer<Response,? extends java.lang.Exception> onResponse,
java.util.function.Consumer<java.lang.Exception> onFailure)
Creates a listener that listens for a response (or failure) and executes the
corresponding consumer when the response (or failure) is received.
|
void onResponse(Response response)
void onFailure(java.lang.Exception e)
static <Response> ActionListener<Response> wrap(CheckedConsumer<Response,? extends java.lang.Exception> onResponse, java.util.function.Consumer<java.lang.Exception> onFailure)
Response
- the type of the responseonResponse
- the consumer of the response, when the listener receives oneonFailure
- the consumer of the failure, when the listener receives onestatic <Response> void onResponse(java.lang.Iterable<ActionListener<Response>> listeners, Response response)
onResponse(Object)
. If a listener itself throws an exception
the exception is forwarded to onFailure(Exception)
. If in turn onFailure(Exception)
fails all remaining
listeners will be processed and the caught exception will be re-thrown.static <Response> void onFailure(java.lang.Iterable<ActionListener<Response>> listeners, java.lang.Exception failure)
onFailure(Exception)
. If a listener itself throws an exception
all remaining listeners will be processed and the caught exception will be re-thrown.