Package 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 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
  Description
  `static class`
  `JobBuilderHelper.CommonJobProperties`

- ## Field Summary

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

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `enhance(Job target)`
  `protected JobRepository`
  `getJobRepository()`
  `protected String`
  `getName()`
  `B`
  `incrementer(JobParametersIncrementer jobParametersIncrementer)`
  Add a job parameters incrementer.
  `protected boolean`
  `isRestartable()`
  `B`
  `listener(Object listener)`
  Registers objects using the annotation based listener configuration.
  `B`
  `listener(JobExecutionListener listener)`
  Register a job execution listener.
  `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 Details

  - ### logger

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

- ## Constructor Details

  - ### JobBuilderHelper

    public JobBuilderHelper(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 Details

  - ### 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(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 String getName()

  - ### getJobRepository

    protected JobRepository getJobRepository()

  - ### isRestartable

    protected boolean isRestartable()

  - ### enhance

    protected void enhance(Job target)