Class StepList<StartInput>

java.lang.Object
io.superdurable.dex.StepList<StartInput>
Type Parameters:
StartInput - the Flow's start input type

public final class StepList<StartInput> extends Object
Declares a Flow's ordered collection of registered Steps.

The type parameter binds the Flow input to its start Step input. Use startStep(Step) for a normally started Flow, withoutStartStep(Step...) for an RPC-started Flow, or empty() for a Flow with no Steps. Add remaining Steps fluently with otherSteps(Step...).

public StepList<OrderInput> getSteps() {
    return StepList.startStep(validate).otherSteps(charge, notifyCustomer);
}
  • Method Details

    • empty

      public static <StartInput> StepList<StartInput> empty()
      Creates an empty Step list for a Flow with no Steps.
      Type Parameters:
      StartInput - the declared Flow start input type
      Returns:
      an empty immutable Step list
    • startStep

      public static <StartInput> StepList<StartInput> startStep(Step<StartInput> startStep)
      Creates a Step list with a typed start Step.
      Type Parameters:
      StartInput - the Flow and start-Step input type
      Parameters:
      startStep - the nonnull start Step whose input matches the Flow input
      Returns:
      an immutable Step list containing the start Step
      Throws:
      NullPointerException - if startStep is null
    • withoutStartStep

      public static <StartInput> StepList<StartInput> withoutStartStep(Step<?>... steps)
      Creates a Step list with no start Step and one or more RPC-targetable Steps.
      Type Parameters:
      StartInput - the declared Flow input type
      Parameters:
      steps - the nonnull non-start Steps
      Returns:
      an immutable Step list without a start Step
      Throws:
      NullPointerException - if the array or any Step is null
    • otherSteps

      public StepList<StartInput> otherSteps(Step<?>... steps)
      Returns a new list with additional non-start Steps.
      Parameters:
      steps - the nonnull Steps to append
      Returns:
      a new immutable Step list; the original list is unchanged
      Throws:
      NullPointerException - if the array or any Step is null