R - result typeS - status typeE - error typepublic interface Promise<R,S,E extends java.lang.Throwable>
| Modifier and Type | Method and Description |
|---|---|
R |
get()
Retrieves a result synchronously.
|
java.lang.Class<E> |
getErrorClass()
Retrieves the error class.
|
Promise<R,S,E> |
onCached(Consumer<R> consumer)
Registers a consumer to be called when cached data becomes available.
|
default Promise<R,S,E> |
onData(Consumer<R> consumer)
Registers a consumer to be called when data becomes available, no matter
if it's cached or not.
|
Promise<R,S,E> |
onDone(Consumer<R> consumer)
Registers a consumer to be called when the call has finished.
|
Promise<R,S,E> |
onFail(Consumer<E> consumer)
Registers a consumer to be called when an error occurs.
|
Promise<R,S,E> |
onStatus(Consumer<S> consumer)
Registers a consumer to be called when status updates are available.
|
default <R2> Promise<R2,S,E> |
pipe(ErrorableFunction<R,R2,E> function)
Creates a processed promise.
|
java.lang.Class<E> getErrorClass()
Promise<R,S,E> onDone(Consumer<R> consumer)
consumer - result consumerPromise<R,S,E> onCached(Consumer<R> consumer)
consumer - cached value consumerdefault Promise<R,S,E> onData(Consumer<R> consumer)
consumer - data consumerPromise<R,S,E> onStatus(Consumer<S> consumer)
consumer - status consumerPromise<R,S,E> onFail(Consumer<E> consumer)
consumer - error consumerR get() throws E extends java.lang.Throwable
E - if the request failedE extends java.lang.Throwabledefault <R2> Promise<R2,S,E> pipe(ErrorableFunction<R,R2,E> function)
R2 - new promise data typefunction - processing function