org.springframework.batch.core.job.flow.support.state

## Class StepState

- java.lang.Object
- - org.springframework.batch.core.job.flow.support.state.AbstractState
  - - org.springframework.batch.core.job.flow.support.state.StepState

- All Implemented Interfaces:
    State, StepHolder, StepLocator
  Direct Known Subclasses:
    JsrStepState

      public class StepState
      extends AbstractState
      implements StepLocator, StepHolder

  `State` implementation that delegates to a `FlowExecutor` to execute the specified `Step`.
  Since:
    2.0
  Author:
    Dave Syer, Michael Minella

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StepState(Step step)`
    `StepState(java.lang.String name, Step step)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Step` | `getStep()` Deprecated. in favor of using `StepLocator.getStep(String)`.
    `Step` | `getStep(java.lang.String stepName)`
    `java.util.Collection<java.lang.String>` | `getStepNames()`
    `FlowExecutionStatus` | `handle(FlowExecutor executor)` Handle some business or processing logic and return a status that can be used to drive a flow to the next `State`.
    `boolean` | `isEndState()` Inquire as to whether a `State` is an end state.

    - ### Methods inherited from class org.springframework.batch.core.job.flow.support.state.AbstractState

      `getName, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### StepState

          public StepState(Step step)

      Parameters:
        `step` - the step that will be executed

    - #### StepState

          public StepState(java.lang.String name,
                           Step step)

      Parameters:
        `name` - for the step that will be executed
        `step` - the step that will be executed

  - ### Method Detail

    - #### handle

          public FlowExecutionStatus handle(FlowExecutor executor)
                                     throws java.lang.Exception

      Description copied from interface: `State`
      Handle some business or processing logic and return a status that can be used to drive a flow to the next `State`. The status can be any string, but special meaning is assigned to the static constants in `FlowExecution`. The context can be used by implementations to do whatever they need to do. The same context will be passed to all `State` instances, so implementations should be careful that the context is thread-safe, or used in a thread-safe manner.
      Specified by:
        `handle` in interface `State`
      Specified by:
        `handle` in class `AbstractState`
      Parameters:
        `executor` - the context passed in by the caller
      Returns:
        a status for the execution
      Throws:
        `java.lang.Exception` - if anything goes wrong

    - #### getStep

          public Step getStep()

      Deprecated. in favor of using `StepLocator.getStep(String)`.
      Specified by:
        `getStep` in interface `StepHolder`

    - #### isEndState

          public boolean isEndState()

      Description copied from interface: `State`
      Inquire as to whether a `State` is an end state. Implementations should return false if processing can continue, even if that would require a restart.
      Specified by:
        `isEndState` in interface `State`
      Returns:
        true if this `State` is the end of processing

    - #### getStepNames

          public java.util.Collection<java.lang.String> getStepNames()

      Specified by:
        `getStepNames` in interface `StepLocator`

    - #### getStep

          public Step getStep(java.lang.String stepName)
                       throws NoSuchStepException

      Specified by:
        `getStep` in interface `StepLocator`
      Throws:
        `NoSuchStepException`