Class AsyncStepExecutor<T>
java.lang.Object
nl.pim16aap2.animatedarchitecture.core.tooluser.stepexecutor.StepExecutor
nl.pim16aap2.animatedarchitecture.core.tooluser.stepexecutor.AsyncStepExecutor<T>
- Type Parameters:
T- The type of the input for the function.
A
StepExecutor that executes a function asynchronously.-
Constructor Summary
ConstructorsConstructorDescriptionAsyncStepExecutor(Class<T> inputClass, Function<T, CompletableFuture<Boolean>> fun) Creates a newAsyncStepExecutor. -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<?> Checks the type that is expected as input for this step.booleanisAsync()Checks if this step is asynchronous.protected CompletableFuture<Boolean> protectedAcceptAsync(@Nullable Object input) Protected version ofStepExecutor.protectedAccept(Object).Methods inherited from class StepExecutor
apply, protectedAccept, toString, validInput
-
Constructor Details
-
AsyncStepExecutor
Creates a newAsyncStepExecutor.- Parameters:
inputClass- The class of the input for the function.fun- The function to execute asynchronously that takes an input of typeTand returns aCompletableFutureofBoolean.The
CompletableFutureshould be completed with the result of the function. If the function is successful, theCompletableFutureshould be completed withtrue. If the function is unsuccessful, theCompletableFutureshould be completed withfalse.
-
-
Method Details
-
protectedAcceptAsync
Description copied from class:StepExecutorProtected version ofStepExecutor.protectedAccept(Object). That method takes care of input type verification.This method should be overridden by subclasses that are asynchronous.
- Overrides:
protectedAcceptAsyncin classStepExecutor- Parameters:
input- The object to give to theBiFunction.
-
getInputClass
Description copied from class:StepExecutorChecks the type that is expected as input for this step.- Specified by:
getInputClassin classStepExecutor- Returns:
- The
Classof the input object.
-
isAsync
public boolean isAsync()Description copied from class:StepExecutorChecks if this step is asynchronous.- Overrides:
isAsyncin classStepExecutor- Returns:
- True if this step is asynchronous.
-