org.springframework.batch.core

## Class JobParametersBuilder

- java.lang.Object
- - org.springframework.batch.core.JobParametersBuilder

-     public class JobParametersBuilder
      extends java.lang.Object

  Helper class for creating `JobParameters`. Useful because all `JobParameter` objects are immutable, and must be instantiated separately to ensure typesafety. Once created, it can be used in the same was a java.lang.StringBuilder (except, order is irrelevant), by adding various parameter types and creating a valid `JobParameters` once finished.
  Using the identifying flag indicates if the parameter will be used in the identification of a JobInstance. That flag defaults to true.
  Since:
    1.0
  Author:
    Lucas Ward, Michael Minella
  See Also:
    `JobParameters`, `JobParameter`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JobParametersBuilder()` Default constructor.
    `JobParametersBuilder(JobParameters jobParameters)` Copy constructor.
    `JobParametersBuilder(java.util.Properties properties)` Constructor to add conversion capabilities to support JSR-352.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `JobParametersBuilder` | `addDate(java.lang.String key, java.util.Date parameter)` Add a new identifying `Date` parameter for the given key.
    `JobParametersBuilder` | `addDate(java.lang.String key, java.util.Date parameter, boolean identifying)` Add a new `Date` parameter for the given key.
    `JobParametersBuilder` | `addDouble(java.lang.String key, java.lang.Double parameter)` Add a new identifying Double parameter for the given key.
    `JobParametersBuilder` | `addDouble(java.lang.String key, java.lang.Double parameter, boolean identifying)` Add a new Double parameter for the given key.
    `JobParametersBuilder` | `addLong(java.lang.String key, java.lang.Long parameter)` Add a new identifying Long parameter for the given key.
    `JobParametersBuilder` | `addLong(java.lang.String key, java.lang.Long parameter, boolean identifying)` Add a new Long parameter for the given key.
    `JobParametersBuilder` | `addParameter(java.lang.String key, JobParameter jobParameter)` Add a new `JobParameter` for the given key.
    `JobParametersBuilder` | `addString(java.lang.String key, java.lang.String parameter)` Add a new identifying String parameter for the given key.
    `JobParametersBuilder` | `addString(java.lang.String key, java.lang.String parameter, boolean identifying)` Add a new String parameter for the given key.
    `JobParameters` | `toJobParameters()` Conversion method that takes the current state of this builder and returns it as a JobruntimeParameters object.

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

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

- - ### Constructor Detail

    - #### JobParametersBuilder

          public JobParametersBuilder()

      Default constructor. Initializes the builder with empty parameters.

    - #### JobParametersBuilder

          public JobParametersBuilder(JobParameters jobParameters)

      Copy constructor. Initializes the builder with the supplied parameters.

    - #### JobParametersBuilder

          public JobParametersBuilder(java.util.Properties properties)

      Constructor to add conversion capabilities to support JSR-352. Per the spec, it is expected that all keys and values in the provided `Properties` instance are Strings
      Parameters:
        `properties` - the job parameters to be used

  - ### Method Detail

    - #### addString

          public JobParametersBuilder addString(java.lang.String key,
                                                java.lang.String parameter)

      Add a new identifying String parameter for the given key.
      Parameters:
        `key` - - parameter accessor.
        `parameter` - - runtime parameter
      Returns:
        a reference to this object.

    - #### addString

          public JobParametersBuilder addString(java.lang.String key,
                                                java.lang.String parameter,
                                                boolean identifying)

      Add a new String parameter for the given key.
      Parameters:
        `key` - - parameter accessor.
        `parameter` - - runtime parameter
        `identifying` - - indicates if the parameter is used as part of identifying a job instance
      Returns:
        a reference to this object.

    - #### addDate

          public JobParametersBuilder addDate(java.lang.String key,
                                              java.util.Date parameter)

      Add a new identifying `Date` parameter for the given key.
      Parameters:
        `key` - - parameter accessor.
        `parameter` - - runtime parameter
      Returns:
        a reference to this object.

    - #### addDate

          public JobParametersBuilder addDate(java.lang.String key,
                                              java.util.Date parameter,
                                              boolean identifying)

      Add a new `Date` parameter for the given key.
      Parameters:
        `key` - - parameter accessor.
        `parameter` - - runtime parameter
        `identifying` - - indicates if the parameter is used as part of identifying a job instance
      Returns:
        a reference to this object.

    - #### addLong

          public JobParametersBuilder addLong(java.lang.String key,
                                              java.lang.Long parameter)

      Add a new identifying Long parameter for the given key.
      Parameters:
        `key` - - parameter accessor.
        `parameter` - - runtime parameter
      Returns:
        a reference to this object.

    - #### addLong

          public JobParametersBuilder addLong(java.lang.String key,
                                              java.lang.Long parameter,
                                              boolean identifying)

      Add a new Long parameter for the given key.
      Parameters:
        `key` - - parameter accessor.
        `parameter` - - runtime parameter
        `identifying` - - indicates if the parameter is used as part of identifying a job instance
      Returns:
        a reference to this object.

    - #### addDouble

          public JobParametersBuilder addDouble(java.lang.String key,
                                                java.lang.Double parameter)

      Add a new identifying Double parameter for the given key.
      Parameters:
        `key` - - parameter accessor.
        `parameter` - - runtime parameter
      Returns:
        a reference to this object.

    - #### addDouble

          public JobParametersBuilder addDouble(java.lang.String key,
                                                java.lang.Double parameter,
                                                boolean identifying)

      Add a new Double parameter for the given key.
      Parameters:
        `key` - - parameter accessor.
        `parameter` - - runtime parameter
        `identifying` - - indicates if the parameter is used as part of identifying a job instance
      Returns:
        a reference to this object.

    - #### toJobParameters

          public JobParameters toJobParameters()

      Conversion method that takes the current state of this builder and returns it as a JobruntimeParameters object.
      Returns:
        a valid `JobParameters` object.

    - #### addParameter

          public JobParametersBuilder addParameter(java.lang.String key,
                                                   JobParameter jobParameter)

      Add a new `JobParameter` for the given key.
      Parameters:
        `key` - - parameter accessor
        `jobParameter` - - runtime parameter
      Returns:
        a reference to this object.