public final class WaitResult extends Object
Use one of the provided methods to repeatedly get some data, until some condition.
| Modifier and Type | Method | Description |
|---|---|---|
static <T> WaitResultBuilder1<T> |
of(Callable<T> action) |
Start the builder to create an instance of
CompletableFuture based on
the result of the received action, with repetition until some condition. |
static <T> WaitResultBuilder2<T> |
on(T mutableObject) |
Start the builder to create an instance of
CompletableFuture based on
repeated control on the mutable object. |
static WaitResultBuilder3<Boolean> |
onCondition(Supplier<Boolean> conditionSupplier) |
Start the builder to create an instance of
CompletableFuture based on
repeated control on a method returning a boolean. |
public static <T> WaitResultBuilder1<T> of(Callable<T> action)
CompletableFuture based on
the result of the received action, with repetition until some condition.
CompletableFuture<Optional<MyObject>> exec = WaitResult.of(MyObject::myCallable).expecting(MyObject::myControl)
.repeat(10).every(10, TimeUnit.MILLISECONDS).asyncExec();
T - The type of the result.action - the Callable providing the result.the next step of the builderpublic static <T> WaitResultBuilder2<T> on(T mutableObject)
CompletableFuture based on
repeated control on the mutable object.
CompletableFuture<Optional<MyObject>> exec = WaitResult.on(myObject).expecting(MyObject::myControl).repeat(100)
.every(10, TimeUnit.MILLISECONDS).asyncExec();
T - The type of the result.mutableObject - the mutable object to be checked.the next step of the builderpublic static WaitResultBuilder3<Boolean> onCondition(Supplier<Boolean> conditionSupplier)
CompletableFuture based on
repeated control on a method returning a boolean.conditionSupplier - the boolean supplierthe next step of the builderCopyright © 2019. All rights reserved.