Package vertxval.exp
Class And
- java.lang.Object
-
- vertxval.exp.And
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Val<O>
fallbackTo(Function<Throwable,Val<O>> fn)
<Q> Val<Q>
flatMap(Function<O,Val<Q>> fn)
Creates a new value by applying a function to the successful result of this value, and returns the result of the function as the new value.<U> Val<U>
flatMap(Function<O,Val<U>> successMapper, Function<Throwable,Val<U>> failureMapper)
io.vertx.core.Future<Boolean>
get()
<P> Val<P>
map(Function<Boolean,P> fn)
Creates a new value by applying a function to the successful result of this value.static Val<Boolean>
of(Val<Boolean> a, Val<Boolean>... others)
Val<O>
onComplete(io.vertx.core.Handler<io.vertx.core.AsyncResult<O>> handler)
Add a handler to be notified of the result.Val<O>
onComplete(Consumer<O> successConsumer, Consumer<Throwable> failure)
Add a handler to be notified of the result.Val<O>
onSuccess(Consumer<O> success)
Adds a consumer to be notified of the succeeded result of this value.Val<O>
recover(Function<Throwable,O> fn)
Creates a new value that will handle any matching throwable that this value might contain.Val<O>
recoverWith(Function<Throwable,Val<O>> fn)
Creates a new value that will handle any matching throwable that this value might contain by assigning it another value.Val<Boolean>
retry(int attempts)
returns a new value tha will retry its execution if it failsVal<Boolean>
retry(int attempts, BiFunction<Throwable,Integer,Val<Void>> actionBeforeRetry)
returns a new value tha will retry its execution after the an action.Val<Boolean>
retryIf(Predicate<Throwable> predicate, int attempts)
returns a new value tha will retry its execution if it fails with an error that satisfies the given predicate.Val<Boolean>
retryIf(Predicate<Throwable> predicate, int attempts, BiFunction<Throwable,Integer,Val<Void>> actionBeforeRetry)
returns a new value tha will retry its execution after an action if it fails with an error that satisfies the given predicate.
-
-
-
Method Detail
-
map
public <P> Val<P> map(Function<Boolean,P> fn)
Description copied from interface:Val
Creates a new value by applying a function to the successful result of this value. If this value returns an exception then the new value will also contain this exception.- Type Parameters:
P
- the type of the returned value- Parameters:
fn
- the function which will be applied to the successful result of this value- Returns:
- a new value
-
retry
public Val<Boolean> retry(int attempts)
Description copied from interface:Val
returns a new value tha will retry its execution if it fails- Parameters:
attempts
- the number of attempts before returning an error- Returns:
- a new value
-
retry
public Val<Boolean> retry(int attempts, BiFunction<Throwable,Integer,Val<Void>> actionBeforeRetry)
Description copied from interface:Val
returns a new value tha will retry its execution after the an action.- Parameters:
attempts
- the number of attempts before returning an erroractionBeforeRetry
- the function that produces the action to be executed before the retry- Returns:
- a new value
-
retryIf
public Val<Boolean> retryIf(Predicate<Throwable> predicate, int attempts)
Description copied from interface:Val
returns a new value tha will retry its execution if it fails with an error that satisfies the given predicate.- Parameters:
predicate
- the predicate against which the returned error will be tested onattempts
- the number of attempts before returning an error- Returns:
- a new value
-
retryIf
public Val<Boolean> retryIf(Predicate<Throwable> predicate, int attempts, BiFunction<Throwable,Integer,Val<Void>> actionBeforeRetry)
Description copied from interface:Val
returns a new value tha will retry its execution after an action if it fails with an error that satisfies the given predicate.- Parameters:
predicate
- the predicate against which the returned error will be tested onattempts
- the number of attempts before returning an erroractionBeforeRetry
- the function that produces the action to be executed before the retry- Returns:
- a new value
-
get
public io.vertx.core.Future<Boolean> get()
-
recover
public Val<O> recover(Function<Throwable,O> fn)
Description copied from interface:Val
Creates a new value that will handle any matching throwable that this value might contain. If there is no match, or if this future contains a valid result then the new future will contain the same.
-
recoverWith
public Val<O> recoverWith(Function<Throwable,Val<O>> fn)
Description copied from interface:Val
Creates a new value that will handle any matching throwable that this value might contain by assigning it another value.- Specified by:
recoverWith
in interfaceVal<O>
- Parameters:
fn
- the function to apply if this Future fails- Returns:
- a new value
-
fallbackTo
public Val<O> fallbackTo(Function<Throwable,Val<O>> fn)
- Specified by:
fallbackTo
in interfaceVal<O>
-
flatMap
public <Q> Val<Q> flatMap(Function<O,Val<Q>> fn)
Description copied from interface:Val
Creates a new value by applying a function to the successful result of this value, and returns the result of the function as the new value. If this value returns an exception then the new value will also contain this exception.
-
onSuccess
public Val<O> onSuccess(Consumer<O> success)
Description copied from interface:Val
Adds a consumer to be notified of the succeeded result of this value.
-
onComplete
public Val<O> onComplete(Consumer<O> successConsumer, Consumer<Throwable> failure)
Description copied from interface:Val
Add a handler to be notified of the result.- Specified by:
onComplete
in interfaceVal<O>
- Parameters:
successConsumer
- the handler that will be called with the succeeded resultfailure
- the handler that will be called with the failed result- Returns:
- a reference to this, so it can be used fluently
-
flatMap
public <U> Val<U> flatMap(Function<O,Val<U>> successMapper, Function<Throwable,Val<U>> failureMapper)
-
onComplete
public Val<O> onComplete(io.vertx.core.Handler<io.vertx.core.AsyncResult<O>> handler)
Description copied from interface:Val
Add a handler to be notified of the result.- Specified by:
onComplete
in interfaceVal<O>
- Parameters:
handler
- the handler that will be called with the result- Returns:
- a reference to this, so it can be used fluently
-
-