I - An input typeR - A result typepublic abstract class AsyncAction<I,R>
extends java.lang.Object
implements com.google.gwt.user.client.rpc.AsyncCallback<R>, java.util.function.Consumer<I>
| Modifier and Type | Class and Description |
|---|---|
private class |
AsyncAction.DefaultAsyncCallback
The default asynchronous callback.
|
| Modifier and Type | Field and Description |
|---|---|
protected AsyncAction.DefaultAsyncCallback |
delegate
The exposed callback used by subclasses of this asynchronous task
|
protected com.google.gwt.user.client.rpc.AsyncCallback<R> |
first
The main asynchronous task
|
protected java.util.function.Consumer<R> |
next
The chained asynchronous task
|
| Constructor and Description |
|---|
AsyncAction()
Setups the base functionality.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onFailure(java.lang.Throwable caught)
The default on error callback method.
|
void |
onSuccess(R result)
The default on success callback method.
|
<I2,R2> void |
then(AsyncAction<I2,R2> action,
com.google.common.base.Function<R,I2> mapper)
Makes the given action to be executed after the main asynchronous action.
|
<R2> void |
then(AsyncAction<R,R2> action)
Makes the given action to be executed after the main asynchronous action.
|
void |
then(java.util.function.Consumer<R> consumer)
Adds a consumer of the output of the main asynchronous action.
|
protected final com.google.gwt.user.client.rpc.AsyncCallback<R> first
protected java.util.function.Consumer<R> next
protected final AsyncAction.DefaultAsyncCallback delegate
public <I2,R2> void then(AsyncAction<I2,R2> action, com.google.common.base.Function<R,I2> mapper)
I2 - An input typeR2 - A result typeaction - The chained asynchronous actionmapper - Maps the output of the main asynchronous action to the input of the next actionpublic <R2> void then(AsyncAction<R,R2> action)
R2 - A result typeaction - The chained asynchronous actionpublic void then(java.util.function.Consumer<R> consumer)
consumer - The consumer of the output of the main asynchronous actionpublic void onFailure(java.lang.Throwable caught)
onFailure in interface com.google.gwt.user.client.rpc.AsyncCallback<R>caught - The exception thrown by the main asynchronous action