Package org.springframework.batch.core

# Class JobParameters

java.lang.Object
org.springframework.batch.core.JobParameters

All Implemented Interfaces:
  `Serializable`

public class JobParameters extends Object implements Serializable
Value object representing runtime parameters to a batch job. Because the parameters have no individual meaning outside of the JobParameters they are contained within, it is a value object rather than an entity. It is also extremely important that a parameters object can be reliably compared to another for equality, in order to determine if one JobParameters object equals another. Furthermore, because these parameters will need to be persisted, it is vital that the types added are restricted. This class is immutable and therefore thread-safe.

Since:
  1.0
Author:
  Lucas Ward, Michael Minella, Mahmoud Ben Hassine, Taeik Lim
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JobParameters()`
  `JobParameters(Map<String,JobParameter> parameters)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `Date`
  `getDate(String key)`
  Typesafe Getter for the Date represented by the provided key.
  `Date`
  `getDate(String key, Date defaultValue)`
  Typesafe Getter for the Date represented by the provided key.
  `Double`
  `getDouble(String key)`
  Typesafe Getter for the Long represented by the provided key.
  `Double`
  `getDouble(String key, Double defaultValue)`
  Typesafe Getter for the Double represented by the provided key.
  `Long`
  `getLong(String key)`
  Typesafe Getter for the Long represented by the provided key.
  `Long`
  `getLong(String key, Long defaultValue)`
  Typesafe Getter for the Long represented by the provided key.
  `Map<String,JobParameter>`
  `getParameters()`
  Get a map of all parameters, including string, long, and date.
  `String`
  `getString(String key)`
  Typesafe Getter for the String represented by the provided key.
  `String`
  `getString(String key, String defaultValue)`
  Typesafe Getter for the String represented by the provided key.
  `int`
  `hashCode()`
  `boolean`
  `isEmpty()`
  `Properties`
  `toProperties()`
  `String`
  `toString()`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### JobParameters

    public JobParameters()

  - ### JobParameters

    public JobParameters(Map<String,JobParameter> parameters)

- ## Method Details

  - ### getLong

    @Nullable public Long getLong(String key)
    Typesafe Getter for the Long represented by the provided key.
    Parameters:
      `key` - The key to get a value for
    Returns:
      The `Long` value or `null` if the key is absent

  - ### getLong

    @Nullable public Long getLong(String key, @Nullable Long defaultValue)
    Typesafe Getter for the Long represented by the provided key. If the key does not exist, the default value will be returned.
    Parameters:
      `key` - to return the value for
      `defaultValue` - to return if the value doesn't exist
    Returns:
      the parameter represented by the provided key, defaultValue otherwise.

  - ### getString

    @Nullable public String getString(String key)
    Typesafe Getter for the String represented by the provided key.
    Parameters:
      `key` - The key to get a value for
    Returns:
      The `String` value or `null` if the key is absent

  - ### getString

    @Nullable public String getString(String key, @Nullable String defaultValue)
    Typesafe Getter for the String represented by the provided key. If the key does not exist, the default value will be returned.
    Parameters:
      `key` - to return the value for
      `defaultValue` - to return if the value doesn't exist
    Returns:
      the parameter represented by the provided key, defaultValue otherwise.

  - ### getDouble

    @Nullable public Double getDouble(String key)
    Typesafe Getter for the Long represented by the provided key.
    Parameters:
      `key` - The key to get a value for
    Returns:
      The `Double` value or `null` if the key is absent

  - ### getDouble

    @Nullable public Double getDouble(String key, @Nullable Double defaultValue)
    Typesafe Getter for the Double represented by the provided key. If the key does not exist, the default value will be returned.
    Parameters:
      `key` - to return the value for
      `defaultValue` - to return if the value doesn't exist
    Returns:
      the parameter represented by the provided key, defaultValue otherwise.

  - ### getDate

    @Nullable public Date getDate(String key)
    Typesafe Getter for the Date represented by the provided key.
    Parameters:
      `key` - The key to get a value for
    Returns:
      The `java.util.Date` value or `null` if the key is absent

  - ### getDate

    @Nullable public Date getDate(String key, @Nullable Date defaultValue)
    Typesafe Getter for the Date represented by the provided key. If the key does not exist, the default value will be returned.
    Parameters:
      `key` - to return the value for
      `defaultValue` - to return if the value doesn't exist
    Returns:
      the parameter represented by the provided key, defaultValue otherwise.

  - ### getParameters

    public Map<String,JobParameter> getParameters()
    Get a map of all parameters, including string, long, and date.
    Returns:
      an unmodifiable map containing all parameters.

  - ### isEmpty

    public boolean isEmpty()
    Returns:
      true if the parameters is empty, false otherwise.

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### toProperties

    public Properties toProperties()