public interface Promise<T> extends Filter<Promise,T,Promise<T>>, TApp<Promise,T,Promise<T>>
| Modifier and Type | Method and Description |
|---|---|
default <R> Promise<R> |
and(FunctionWithError<? super T,R> function)
Method use 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 use 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,R> function)
Method use to map a function.
|
void |
onComplete(java.util.function.Consumer<Try<T>> consumer)
Callback called when the computation terminates
|
void |
onFailure(java.util.function.Consumer<Throwable> consumer)
Callback called when the computation fails
|
void |
onSuccess(java.util.function.Consumer<T> consumer)
Callback called when the computation succeed
|
default <R> Promise<R> |
then(java.util.function.Function<? super T,Promise<R>> function)
Method use when a new asynchronous computation must be done when the current one succeed.
|
Future<T> getFuture()
void onSuccess(java.util.function.Consumer<T> consumer)
consumer - The callback to be activated on successvoid onFailure(java.util.function.Consumer<Throwable> consumer)
consumer - The callback to be activated on errorvoid onComplete(java.util.function.Consumer<Try<T>> consumer)
consumer - The callback to be activated on completion<R> Promise<R> map(FunctionWithError<? super T,R> function)
function - The function to applied on success which can raise an errordefault <R> Promise<R> and(FunctionWithError<? super T,R> function)
function - The function to applied on success<R> Promise<R> flatmap(java.util.function.Function<? super T,Promise<R>> function)
function - The function to applied on successdefault <R> Promise<R> then(java.util.function.Function<? super T,Promise<R>> function)
function - The function to applied on successCopyright © 2017. All rights reserved.