Class SyncStepFunction<T,R>

java.lang.Object
com.koralix.stepfn.StepFunction<T,R,R>
com.koralix.stepfn.SyncStepFunction<T,R>
Type Parameters:
T - the type of the input to the function
R - the type of the result of the function
All Implemented Interfaces:
Function<T,R>

public class SyncStepFunction<T,R> extends StepFunction<T,R,R>
A StepFunction that computes its result synchronously.

Check the StepFunction documentation for more information and examples.

Since:
1.0.0
See Also:
  • Constructor Details

    • SyncStepFunction

      @Deprecated public SyncStepFunction(Step<T,?> initialStep, Map<Step<?,?>,Set<Transition<?,?>>> transitions)
      Deprecated.
      use SyncStepFunction(Step) instead - this constructor will be removed in 1.2.0
      Creates a new SyncStepFunction with the given initial step and transitions.
      Parameters:
      initialStep - the initial step
      transitions - the transitions
      Since:
      1.0.0
    • SyncStepFunction

      public SyncStepFunction(Step<T,?> initialStep)
      Creates a new SyncStepFunction with the given initial step.
      Parameters:
      initialStep - the initial step
      Since:
      1.0.0
  • Method Details

    • apply

      public R apply(T t)
      Applies this function to the given argument.
      Parameters:
      t - the function argument
      Returns:
      the function result
      Since:
      1.0.0
    • step

      protected <A, B> Optional<CompletableFuture<B>> step(Step<A,B> step, Step<?,?> from, A input)
      Applies the given Step to the given input.

      If the Step is complete, the result is returned in a completed CompletableFuture.

      If the step is not complete, an empty Optional is returned and the input is aggregated.

      Specified by:
      step in class StepFunction<T,R,R>
      Type Parameters:
      A - the input type of the step
      B - the output type of the step
      Parameters:
      step - the step to apply
      from - the step from which the input was received
      input - the input to the step
      Returns:
      the result of the step in a completed CompletableFuture if the step is complete, an empty Optional otherwise
      Since:
      1.0.0