public class SolvablePromise<T> extends Object
| Constructor and Description |
|---|
SolvablePromise() |
| Modifier and Type | Method and Description |
|---|---|
<R> R |
apply(java.util.function.Function<HK<Promise,T,Promise<T>>,R> f) |
protected SolvableFuture<T> |
createFuture(java.util.function.Consumer<Try<T>> callbackOnComplete) |
HK<Promise,T,Promise<T>> |
filter(java.util.function.Predicate<? super T> predicate)
Method called when the current data must be filtered using a given predicate.
|
<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
|
Promise<T> |
self() |
boolean |
solve(Try<T> response) |
public Future<T> getFuture()
Promisepublic Promise<T> onSuccess(java.util.function.Consumer<T> consumer)
Promiseconsumer - The callback to be activated on successpublic Promise<T> onFailure(java.util.function.Consumer<Throwable> consumer)
Promiseconsumer - The callback to be activated on errorpublic Promise<T> onComplete(java.util.function.Consumer<Try<T>> consumer)
Promiseconsumer - The callback to be activated on completionprotected SolvableFuture<T> createFuture(java.util.function.Consumer<Try<T>> callbackOnComplete)
public <R> R apply(java.util.function.Function<HK<Promise,T,Promise<T>>,R> f)
public final <R> Promise<R> map(FunctionWithError<? super T,? extends R> function)
Promisepublic final <R> Promise<R> flatmap(java.util.function.Function<? super T,Promise<R>> function)
Promisepublic HK<Promise,T,Promise<T>> filter(java.util.function.Predicate<? super T> predicate)
FilterCopyright © 2020. All rights reserved.