org.springframework.batch.core.step.builder

## Class StepBuilder

- java.lang.Object
- - org.springframework.batch.core.step.builder.StepBuilderHelper<StepBuilder>
  - - org.springframework.batch.core.step.builder.StepBuilder

- Direct Known Subclasses:
    RemotePartitioningWorkerStepBuilder

      public class StepBuilder
      extends StepBuilderHelper<StepBuilder>

  Convenient entry point for building all kinds of steps. Use this as a factory for fluent builders of any step.
  Since:
    2.2
  Author:
    Dave Syer

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.springframework.batch.core.step.builder.StepBuilderHelper

      `StepBuilderHelper.CommonStepProperties`

  - ### Field Summary

    - ### Fields inherited from class org.springframework.batch.core.step.builder.StepBuilderHelper

      `logger, properties`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StepBuilder(java.lang.String name)` Initialize a step builder for a step with the given name.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<I,O> SimpleStepBuilder<I,O>` | `chunk(CompletionPolicy completionPolicy)` Build a step that processes items in chunks with the completion policy provided.
    `<I,O> SimpleStepBuilder<I,O>` | `chunk(int chunkSize)` Build a step that processes items in chunks with the size provided.
    `FlowStepBuilder` | `flow(Flow flow)` Create a new step builder that will execute a flow.
    `JobStepBuilder` | `job(Job job)` Create a new step builder that will execute a job.
    `PartitionStepBuilder` | `partitioner(Step step)` Create a partition step builder for a remote (or local) step.
    `PartitionStepBuilder` | `partitioner(java.lang.String stepName, Partitioner partitioner)` Create a partition step builder for a remote (or local) step.
    `TaskletStepBuilder` | `tasklet(Tasklet tasklet)` Build a step with a custom tasklet, not necessarily item processing.

    - ### Methods inherited from class org.springframework.batch.core.step.builder.StepBuilderHelper

      `allowStartIfComplete, enhance, getJobRepository, getName, getTransactionManager, isAllowStartIfComplete, listener, listener, repository, startLimit, transactionManager`

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

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

- - ### Constructor Detail

    - #### StepBuilder

          public StepBuilder(java.lang.String name)

      Initialize a step builder for a step with the given name.
      Parameters:
        `name` - the name of the step

  - ### Method Detail

    - #### tasklet

          public TaskletStepBuilder tasklet(Tasklet tasklet)

      Build a step with a custom tasklet, not necessarily item processing.
      Parameters:
        `tasklet` - a tasklet
      Returns:
        a `TaskletStepBuilder`

    - #### chunk

          public <I,O> SimpleStepBuilder<I,O> chunk(int chunkSize)

      Build a step that processes items in chunks with the size provided. To extend the step to being fault tolerant, call the `SimpleStepBuilder.faultTolerant()` method on the builder. In most cases you will want to parameterize your call to this method, to preserve the type safety of your readers and writers, e.g.

           new StepBuilder("step1").<Order, Ledger> chunk(100).reader(new OrderReader()).writer(new LedgerWriter())
           // ... etc.

      Type Parameters:
        `I` - the type of item to be processed as input
        `O` - the type of item to be output
      Parameters:
        `chunkSize` - the chunk size (commit interval)
      Returns:
        a `SimpleStepBuilder`

    - #### chunk

          public <I,O> SimpleStepBuilder<I,O> chunk(CompletionPolicy completionPolicy)

      Build a step that processes items in chunks with the completion policy provided. To extend the step to being fault tolerant, call the `SimpleStepBuilder.faultTolerant()` method on the builder. In most cases you will want to parameterize your call to this method, to preserve the type safety of your readers and writers, e.g.

           new StepBuilder("step1").<Order, Ledger> chunk(100).reader(new OrderReader()).writer(new LedgerWriter())
           // ... etc.

      Type Parameters:
        `I` - the type of item to be processed as input
        `O` - the type of item to be output *
      Parameters:
        `completionPolicy` - the completion policy to use to control chunk processing
      Returns:
        a `SimpleStepBuilder`

    - #### partitioner

          public PartitionStepBuilder partitioner(java.lang.String stepName,
                                                  Partitioner partitioner)

      Create a partition step builder for a remote (or local) step.
      Parameters:
        `stepName` - the name of the remote or delegate step
        `partitioner` - a partitioner to be used to construct new step executions
      Returns:
        a `PartitionStepBuilder`

    - #### partitioner

          public PartitionStepBuilder partitioner(Step step)

      Create a partition step builder for a remote (or local) step.
      Parameters:
        `step` - the step to execute in parallel
      Returns:
        a PartitionStepBuilder

    - #### job

          public JobStepBuilder job(Job job)

      Create a new step builder that will execute a job.
      Parameters:
        `job` - a job to execute
      Returns:
        a `JobStepBuilder`

    - #### flow

          public FlowStepBuilder flow(Flow flow)

      Create a new step builder that will execute a flow.
      Parameters:
        `flow` - a flow to execute
      Returns:
        a `FlowStepBuilder`