public interface Promise<T> extends Filter<Promise,T,Promise<T>>, HK<Promise,T,Promise<T>>
| Modifier and Type | Method and Description |
|---|---|
default <R> Promise<R> |
and(FunctionWithError<? super T,R> function)
Method used when a new computation must be done when the current one succeed.
|
<R> Promise<R> |
flatmap(java.util.function.Function<? super T,Promise<R>> function)
Method used to flatmap a function.
|
Future<T> |
getFuture()
Provides the underlying future able to capture and returns the result or the error for a given execution
|
<R> Promise<R> |
map(FunctionWithError<? super T,? extends R> function)
Method used to map a function.
|
Promise<T> |
onComplete(java.util.function.Consumer<Try<T>> consumer)
Callback called when the computation terminates
|
Promise<T> |
onFailure(java.util.function.Consumer<Throwable> consumer)
Method called when the computation fails
|
Promise<T> |
onSuccess(java.util.function.Consumer<T> consumer)
Method called when the computation succeed
|
default <R> Promise<R> |
then(java.util.function.Function<? super T,Promise<R>> function)
Method used when a new asynchronous computation must be done when the current one succeed.
|
Future<T> getFuture()
Promise<T> onSuccess(java.util.function.Consumer<T> consumer)
consumer - The callback to be activated on successPromise<T> onFailure(java.util.function.Consumer<Throwable> consumer)
consumer - The callback to be activated on errorPromise<T> onComplete(java.util.function.Consumer<Try<T>> consumer)
consumer - The callback to be activated on completion<R> Promise<R> map(FunctionWithError<? super T,? extends R> function)
R - the promised value typefunction - The function to applied on success which can raise an errordefault <R> Promise<R> and(FunctionWithError<? super T,R> function)
R - the promised value typefunction - The function to applied on success<R> Promise<R> flatmap(java.util.function.Function<? super T,Promise<R>> function)
R - the promised value typefunction - The function to applied on successdefault <R> Promise<R> then(java.util.function.Function<? super T,Promise<R>> function)
R - the promised value typefunction - The function to applied on successCopyright © 2020. All rights reserved.