org.springframework.batch.core.job.builder

## Class JobBuilderHelper<B extends JobBuilderHelper<B>>

- java.lang.Object
- - org.springframework.batch.core.job.builder.JobBuilderHelper<B>

- Direct Known Subclasses:
    FlowJobBuilder, JobBuilder, SimpleJobBuilder

      public abstract class JobBuilderHelper<B extends JobBuilderHelper<B>>
      extends java.lang.Object

  A base class and utility for other job builders providing access to common properties like job repository.
  Since:
    2.2
  Author:
    Dave Syer, Mahmoud Ben Hassine

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JobBuilderHelper.CommonJobProperties`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.commons.logging.Log` | `logger`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JobBuilderHelper(JobBuilderHelper<?> parent)` Create a new builder initialized with any properties in the parent.
    `` | `JobBuilderHelper(java.lang.String name)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `enhance(Job target)`
    `protected JobRepository` | `getJobRepository()`
    `protected java.lang.String` | `getName()`
    `B` | `incrementer(JobParametersIncrementer jobParametersIncrementer)` Add a job parameters incrementer.
    `protected boolean` | `isRestartable()`
    `B` | `listener(JobExecutionListener listener)` Register a job execution listener.
    `B` | `listener(java.lang.Object listener)` Registers objects using the annotation based listener configuration.
    `B` | `preventRestart()` Set a flag to prevent restart an execution of this job even if it has failed.
    `B` | `repository(JobRepository jobRepository)` Sets the job repository for the job.
    `B` | `validator(JobParametersValidator jobParametersValidator)` Add a job parameters validator.

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

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

- - ### Field Detail

    - #### logger

          protected final org.apache.commons.logging.Log logger

  - ### Constructor Detail

    - #### JobBuilderHelper

          public JobBuilderHelper(java.lang.String name)

    - #### JobBuilderHelper

          protected JobBuilderHelper(JobBuilderHelper<?> parent)

      Create a new builder initialized with any properties in the parent. The parent is copied, so it can be re-used.
      Parameters:
        `parent` - a parent helper containing common step properties

  - ### Method Detail

    - #### validator

          public B validator(JobParametersValidator jobParametersValidator)

      Add a job parameters validator.
      Parameters:
        `jobParametersValidator` - a job parameters validator
      Returns:
        this to enable fluent chaining

    - #### incrementer

          public B incrementer(JobParametersIncrementer jobParametersIncrementer)

      Add a job parameters incrementer.
      Parameters:
        `jobParametersIncrementer` - a job parameters incrementer
      Returns:
        this to enable fluent chaining

    - #### repository

          public B repository(JobRepository jobRepository)

      Sets the job repository for the job.
      Parameters:
        `jobRepository` - the job repository (mandatory)
      Returns:
        this to enable fluent chaining

    - #### listener

          public B listener(java.lang.Object listener)

      Registers objects using the annotation based listener configuration.
      Parameters:
        `listener` - the object that has a method configured with listener annotation
      Returns:
        this for fluent chaining

    - #### listener

          public B listener(JobExecutionListener listener)

      Register a job execution listener.
      Parameters:
        `listener` - a job execution listener
      Returns:
        this to enable fluent chaining

    - #### preventRestart

          public B preventRestart()

      Set a flag to prevent restart an execution of this job even if it has failed.
      Returns:
        this to enable fluent chaining

    - #### getName

          protected java.lang.String getName()

    - #### getJobRepository

          protected JobRepository getJobRepository()

    - #### isRestartable

          protected boolean isRestartable()

    - #### enhance

          protected void enhance(Job target)