Package org.springframework.batch.core
Class JobParameters
java.lang.Object
org.springframework.batch.core.JobParameters
- All Implemented Interfaces:
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:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.JobParameters
(Map<String, JobParameter> parameters) Constructor that is initialized with the content of aMap
that contains a string key andJobParameter
value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Typesafe Getter for the Date represented by the provided key.Typesafe Getter for the Date represented by the provided key.Typesafe Getter for the Long represented by the provided key.Typesafe Getter for the Double represented by the provided key.Typesafe Getter for the Long represented by the provided key.Typesafe Getter for the Long represented by the provided key.Get a map of all parameters, including string, long, and date.Typesafe Getter for the String represented by the provided key.Typesafe Getter for the String represented by the provided key.int
hashCode()
boolean
isEmpty()
toString()
-
Constructor Details
-
JobParameters
public JobParameters()Default constructor. -
JobParameters
Constructor that is initialized with the content of aMap
that contains a string key andJobParameter
value.- Parameters:
parameters
- TheMap
that contains a string key andJobParameter
value.
-
-
Method Details
-
getLong
Typesafe Getter for the Long represented by the provided key.- Parameters:
key
- The key to get a value for- Returns:
- The
Long
value ornull
if the key is absent
-
getLong
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 fordefaultValue
- to return if the value doesn't exist- Returns:
- the parameter represented by the provided key, defaultValue otherwise.
-
getString
Typesafe Getter for the String represented by the provided key.- Parameters:
key
- The key to get a value for- Returns:
- The
String
value ornull
if the key is absent
-
getString
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 fordefaultValue
- to return if the value doesn't exist- Returns:
- the parameter represented by the provided key, defaultValue otherwise.
-
getDouble
Typesafe Getter for the Long represented by the provided key.- Parameters:
key
- The key to get a value for- Returns:
- The
Double
value ornull
if the key is absent
-
getDouble
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 fordefaultValue
- to return if the value doesn't exist- Returns:
- the parameter represented by the provided key, defaultValue otherwise.
-
getDate
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 ornull
if the key is absent
-
getDate
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 fordefaultValue
- to return if the value doesn't exist- Returns:
- the parameter represented by the provided key, defaultValue otherwise.
-
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
-
hashCode
public int hashCode() -
toString
-
toProperties
- Returns:
- The
Properties
that contain the key and values for theJobParameter
s.
-