Class RunIdIncrementer
java.lang.Object
org.springframework.batch.core.launch.support.RunIdIncrementer
- All Implemented Interfaces:
JobParametersIncrementer
This incrementer increments a "run.id" parameter of type
Long
from the given
job parameters. If the parameter does not exist, it will be initialized to 1. The
parameter name can be configured using setKey(String)
.- Author:
- Dave Syer, Mahmoud Ben Hassine, Jinho Han
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetNext
(JobParameters parameters) Increment the run.id parameter (starting with 1).void
The name of the run id in the job parameters.
-
Constructor Details
-
RunIdIncrementer
public RunIdIncrementer()
-
-
Method Details
-
setKey
The name of the run id in the job parameters. Defaults to "run.id".- Parameters:
key
- the key to set
-
getNext
Increment the run.id parameter (starting with 1).- Specified by:
getNext
in interfaceJobParametersIncrementer
- Parameters:
parameters
- the previous job parameters- Returns:
- the next job parameters with an incremented (or initialized) run.id
- Throws:
IllegalArgumentException
- if the previous value of run.id is invalid
-