public abstract class InvocationStage extends Object
It is similar to a CompletionStage, but it allows more callback functions
to be stateless by passing the context and the invoked command as parameters.
Unlike CompletionStage, adding a callback can delay the completion
of the initial stage and change its result.
| Constructor and Description |
|---|
InvocationStage() |
| Modifier and Type | Method and Description |
|---|---|
abstract <C extends VisitableCommand> |
addCallback(InvocationContext ctx,
C command,
InvocationCallback<C> function)
After the current stage completes, invoke
function and return its result. |
<C extends VisitableCommand> |
andExceptionally(InvocationContext ctx,
C command,
InvocationExceptionFunction<C> function)
After the current stage completes exceptionally, invoke
function and return its result. |
<C extends VisitableCommand> |
andExceptionallyMakeStage(InvocationContext ctx,
C command,
InvocationExceptionFunction<C> function)
After the current stage completes exceptionally, invoke
function and return its result. |
<C extends VisitableCommand> |
andFinally(InvocationContext ctx,
C command,
InvocationFinallyAction<C> action)
After the current stage completes, invoke
action. |
<C extends VisitableCommand> |
andFinallyMakeStage(InvocationContext ctx,
C command,
InvocationFinallyAction<C> action)
After the current stage completes, invoke
action. |
<C extends VisitableCommand> |
andHandle(InvocationContext ctx,
C command,
InvocationFinallyFunction<C> function)
After the current stage completes, invoke
function and return its result. |
<C extends VisitableCommand> |
andHandleMakeStage(InvocationContext ctx,
C command,
InvocationFinallyFunction<C> function)
After the current stage completes, invoke
function and return its result. |
static InvocationStage |
completedNullStage() |
abstract Object |
get()
Wait for the invocation to complete and return its value.
|
abstract boolean |
isDone() |
static InvocationStage |
makeStage(Object maybeStage)
If
maybeStage is not an InvocationStage, wrap it, otherwise cast it to an InvocationStage. |
<C extends VisitableCommand> |
thenAccept(InvocationContext ctx,
C command,
InvocationSuccessAction<C> action)
After the current stage completes successfully, invoke
action. |
<C extends VisitableCommand> |
thenAcceptMakeStage(InvocationContext ctx,
C command,
InvocationSuccessAction<C> action)
After the current stage completes successfully, invoke
action. |
<C extends VisitableCommand> |
thenApply(InvocationContext ctx,
C command,
InvocationSuccessFunction<C> function)
After the current stage completes successfully, invoke
function and return its result. |
<C extends VisitableCommand> |
thenApplyMakeStage(InvocationContext ctx,
C command,
InvocationSuccessFunction<C> function)
After the current stage completes successfully, invoke
function and return its result. |
Object |
thenReturn(InvocationContext ctx,
VisitableCommand command,
Object returnValue)
Overrides the return value of this
InvocationStage if it is completed successfully. |
abstract CompletableFuture<Object> |
toCompletableFuture()
CompletableFuture conversion. |
public abstract Object get() throws Throwable
Throwable - Any exception raised during the invocation.public abstract boolean isDone()
true if the invocation is complete.public abstract CompletableFuture<Object> toCompletableFuture()
CompletableFuture conversion.public <C extends VisitableCommand> Object thenApply(InvocationContext ctx, C command, InvocationSuccessFunction<C> function)
function and return its result.
The result may be either a plain value, this, or a new InvocationStage.
If function throws an exception, the result InvocationStage will complete with the same exception.
public <C extends VisitableCommand> Object thenAccept(InvocationContext ctx, C command, InvocationSuccessAction<C> action)
action.
The result may be either a plain value, this, or a new InvocationStage.
If action throws an exception, the result InvocationStage will complete with the same exception.
public <C extends VisitableCommand> Object andExceptionally(InvocationContext ctx, C command, InvocationExceptionFunction<C> function)
function and return its result.
The result may be either a plain value, this, or a new InvocationStage.
If function throws an exception, the result InvocationStage will complete with the same exception.
public <C extends VisitableCommand> Object andFinally(InvocationContext ctx, C command, InvocationFinallyAction<C> action)
action.
The result may be either a plain value, this, or a new InvocationStage.
If action throws an exception, the result InvocationStage will complete with the same exception.
public <C extends VisitableCommand> Object andHandle(InvocationContext ctx, C command, InvocationFinallyFunction<C> function)
function and return its result.
The result may be either a plain value, this, or a new InvocationStage.
If function throws an exception, the result InvocationStage will complete with the same exception.
public abstract <C extends VisitableCommand> Object addCallback(InvocationContext ctx, C command, InvocationCallback<C> function)
function and return its result.
The result may be either a plain value, or a new InvocationStage.
If function throws an exception, the result InvocationStage will complete with the same exception.
public <C extends VisitableCommand> InvocationStage thenApplyMakeStage(InvocationContext ctx, C command, InvocationSuccessFunction<C> function)
function and return its result.
The result may be either this, or a new InvocationStage.
If function throws an exception, the result InvocationStage will complete with the same exception.
public <C extends VisitableCommand> InvocationStage thenAcceptMakeStage(InvocationContext ctx, C command, InvocationSuccessAction<C> action)
action.
The result may be either this, or a new InvocationStage.
If action throws an exception, the result InvocationStage will complete with the same exception.
public <C extends VisitableCommand> InvocationStage andExceptionallyMakeStage(InvocationContext ctx, C command, InvocationExceptionFunction<C> function)
function and return its result.
The result may be either this, or a new InvocationStage.
If function throws an exception, the result InvocationStage will complete with the same exception.
public <C extends VisitableCommand> InvocationStage andFinallyMakeStage(InvocationContext ctx, C command, InvocationFinallyAction<C> action)
action.
The result may be either this, or a new InvocationStage.
If action throws an exception, the result InvocationStage will complete with the same exception.
public <C extends VisitableCommand> InvocationStage andHandleMakeStage(InvocationContext ctx, C command, InvocationFinallyFunction<C> function)
function and return its result.
The result may be either this, or a new InvocationStage.
If function throws an exception, the result InvocationStage will complete with the same exception.
public static InvocationStage makeStage(Object maybeStage)
maybeStage is not an InvocationStage, wrap it, otherwise cast it to an InvocationStage.public static InvocationStage completedNullStage()
InvocationStage instance completed successfully with value null.public Object thenReturn(InvocationContext ctx, VisitableCommand command, Object returnValue)
InvocationStage if it is completed successfully.
The result may be either rv, a new InvocationStage or thisCopyright © 2022 JBoss by Red Hat. All rights reserved.