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
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JobBuilderHelper.CommonJobProperties
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.logging.Log
logger
Constructor Summary
Constructors Modifier Constructor Description JobBuilderHelper(java.lang.String name)
protected
JobBuilderHelper(JobBuilderHelper<?> parent)
Create a new builder initialized with any properties in the parent.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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
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.
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(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)