Class StepExecutor
java.lang.Object
nl.pim16aap2.animatedarchitecture.core.tooluser.stepexecutor.StepExecutor
- Direct Known Subclasses:
AsyncStepExecutor, StepExecutorBoolean, StepExecutorInteger, StepExecutorLocation, StepExecutorOpenDirection, StepExecutorString, StepExecutorVector3Di, StepExecutorVoid
Represents an executor for a single step in a larger procedure.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal CompletableFuture<Boolean> Applies an object to the function defined for this step.protected abstract Class<?> Checks the type that is expected as input for this step.booleanisAsync()Checks if this step is asynchronous.protected booleanprotectedAccept(@Nullable Object obj) Protected version ofapply(Object).protected CompletableFuture<Boolean> protectedAcceptAsync(@Nullable Object obj) Protected version ofprotectedAccept(Object).@NonNull StringtoString()booleanvalidInput(@Nullable Object obj) Checks if an object is a valid input type.
-
Constructor Details
-
StepExecutor
public StepExecutor()
-
-
Method Details
-
apply
public final CompletableFuture<Boolean> apply(@Nullable Object input) throws IllegalArgumentException Applies an object to the function defined for this step.While this method returns a
CompletableFuture, it is not guaranteed to be asynchronous. If the step is synchronous, it will return a completed future.- Parameters:
input- The object to give to the provided function.- Throws:
IllegalArgumentException- If the input object is not of the expected type.
-
protectedAccept
Protected version ofapply(Object). That method takes care of input type verification.This method should be overridden by subclasses that are synchronous.
- Parameters:
obj- The object to process in this step.
-
protectedAcceptAsync
Protected version ofprotectedAccept(Object). That method takes care of input type verification.This method should be overridden by subclasses that are asynchronous.
- Parameters:
obj- The object to give to theBiFunction.
-
validInput
Checks if an object is a valid input type.- Parameters:
obj- The object to check.- Returns:
- True if this object is valid for the current type.
-
getInputClass
-
isAsync
public boolean isAsync()Checks if this step is asynchronous.- Returns:
- True if this step is asynchronous.
-
toString
-