Module io.helidon.common.reactive
Package io.helidon.common.reactive
Interface OptionalCompletionStage<T>
-
- Type Parameters:
T
- return type of the asynchronous operation
- All Superinterfaces:
CompletionStage<Optional<T>>
public interface OptionalCompletionStage<T> extends CompletionStage<Optional<T>>
A completion stage that allows processing of cases when the element is present and when not.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static <T> OptionalCompletionStage<T>
create(CompletionStage<Optional<T>> originalStage)
Creates a new instance of the completion stage that allows processing of cases when the element is present and when not.OptionalCompletionStage<T>
onEmpty(Runnable action)
Returns a newOptionalCompletionStage
that, when this stage completes normally and returnsnull
, executes the given action.OptionalCompletionStage<T>
onValue(Consumer<? super T> action)
Returns a newOptionalCompletionStage
that, when this stage completes normally and returns non-null
, is executed with this stage's result as the argument to the supplied action.-
Methods inherited from interface java.util.concurrent.CompletionStage
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, handle, handleAsync, handleAsync, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsync
-
-
-
-
Method Detail
-
onEmpty
OptionalCompletionStage<T> onEmpty(Runnable action)
Returns a newOptionalCompletionStage
that, when this stage completes normally and returnsnull
, executes the given action.- Parameters:
action
- the action to perform before completing the returnedOptionalCompletionStage
- Returns:
- the new
OptionalCompletionStage
-
onValue
OptionalCompletionStage<T> onValue(Consumer<? super T> action)
Returns a newOptionalCompletionStage
that, when this stage completes normally and returns non-null
, is executed with this stage's result as the argument to the supplied action.- Parameters:
action
- the action to perform before completing the returnedOptionalCompletionStage
- Returns:
- the new
OptionalCompletionStage
-
create
static <T> OptionalCompletionStage<T> create(CompletionStage<Optional<T>> originalStage)
Creates a new instance of the completion stage that allows processing of cases when the element is present and when not.- Type Parameters:
T
- return type of the asynchronous operation- Parameters:
originalStage
- source completion stage instance- Returns:
- the new
OptionalCompletionStage
-
-