org.springframework.batch.core.launch.support

## Class RunIdIncrementer

- java.lang.Object
- - org.springframework.batch.core.launch.support.RunIdIncrementer

- All Implemented Interfaces:
    JobParametersIncrementer

      public class RunIdIncrementer
      extends java.lang.Object
      implements 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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RunIdIncrementer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `JobParameters` | `getNext(JobParameters parameters)` Increment the run.id parameter (starting with 1).
    `void` | `setKey(java.lang.String key)` The name of the run id in the job parameters.

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

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

- - ### Constructor Detail

    - #### RunIdIncrementer

          public RunIdIncrementer()

  - ### Method Detail

    - #### setKey

          public void setKey(java.lang.String key)

      The name of the run id in the job parameters. Defaults to "run.id".
      Parameters:
        `key` - the key to set

    - #### getNext

          public JobParameters getNext(@Nullable
                                       JobParameters parameters)

      Increment the run.id parameter (starting with 1).
      Specified by:
        `getNext` in interface `JobParametersIncrementer`
      Parameters:
        `parameters` - the previous job parameters
      Returns:
        the next job parameters with an incremented (or initialized) run.id
      Throws:
        `java.lang.IllegalArgumentException` - if the previous value of run.id is invalid