Package com.koralix.stepfn.builder
Class StepFunctionBuilder<T,R>
java.lang.Object
com.koralix.stepfn.builder.StepFunctionBuilder<T,R>
- Type Parameters:
T- the type of the input to the functionR- the type of the result of the function
A builder for
StepFunctions.- Since:
- 1.1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<V> AsyncStepFunction<T,V> async(Supplier<ExecutorService> executorSupplier) Creates a newAsyncStepFunctionfrom this builder.static <T,V> StepFunctionBuilder<T, V> Creates a newStepFunctionBuilderwith the given initial step.static <T,V> StepFunctionBuilder<T, V> Creates a newStepFunctionBuilderwith the given initial step.<V> SyncStepFunction<T,V> sync()Creates a newSyncStepFunctionfrom this builder.transition(Function<R, Boolean> condition, StepFunctionBuilder<R, ?> nextStep) Adds a transition to this builder.<V> StepFunctionBuilder<T,R> transition(Function<R, Boolean> condition, Function<R, V> mapper, StepFunctionBuilder<V, ?> nextStep) Adds a transition to this builder.
-
Method Details
-
step
public static <T,V> StepFunctionBuilder<T,V> step(Function<Map<Step<?, ?>, T>, Boolean> isComplete, BiFunction<T, Map<Step<?, ?>, T>, V> apply) Creates a newStepFunctionBuilderwith the given initial step.- Type Parameters:
T- the type of the input to the functionV- the type of the result of the function- Parameters:
isComplete- a function that returnstrueif the step is complete. Used for aggregating steps.apply- the function to apply to the input- Returns:
- a new
StepFunctionBuilder - Since:
- 1.1.1
- See Also:
-
step
Creates a newStepFunctionBuilderwith the given initial step.- Type Parameters:
T- the type of the input to the functionV- the type of the result of the function- Parameters:
apply- the function to apply to the input- Returns:
- a new
StepFunctionBuilder - Since:
- 1.1.0
- See Also:
-
sync
Creates a newSyncStepFunctionfrom this builder.- Type Parameters:
V- the type of the result of the function- Returns:
- a new
SyncStepFunction - Since:
- 1.1.0
- See Also:
-
async
Creates a newAsyncStepFunctionfrom this builder.- Type Parameters:
V- the type of the result of the function- Parameters:
executorSupplier- the supplier of the executor to use for asynchronous computation- Returns:
- a new
AsyncStepFunction - Since:
- 1.1.0
- See Also:
-
transition
public StepFunctionBuilder<T,R> transition(Function<R, Boolean> condition, StepFunctionBuilder<R, ?> nextStep) Adds a transition to this builder.- Parameters:
condition- the condition to checknextStep- the next step to transition to- Returns:
- this builder
- Since:
- 1.1.0
- See Also:
-
transition
public <V> StepFunctionBuilder<T,R> transition(Function<R, Boolean> condition, Function<R, V> mapper, StepFunctionBuilder<V, ?> nextStep) Adds a transition to this builder.- Type Parameters:
V- the type of the input of the next step- Parameters:
condition- the condition to checkmapper- the mapper to apply to the result of the previous stepnextStep- the next step to transition to- Returns:
- this builder
- Since:
- 1.1.0
- See Also:
-