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
object 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 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
ConstructorDescriptionDefault constructor.JobParameters
(Map<String, JobParameter<?>> parameters) Constructor that is initialized with the content of aMap
that contains aString
key and aJobParameter
value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Typesafe getter for theDate
represented by the provided key.Typesafe getter for theDate
represented by the provided key.Typesafe getter for theDouble
represented by the provided key.Typesafe getter for theDouble
represented by the provided key.Map<String,
JobParameter<?>> Get a map of identifying parameters.getLocalDate
(String key) Typesafe getter for theLocalDate
represented by the provided key.getLocalDate
(String key, LocalDate defaultValue) Typesafe getter for theLocalDate
represented by the provided key.getLocalDateTime
(String key) Typesafe getter for theLocalDateTime
represented by the provided key.getLocalDateTime
(String key, LocalDateTime defaultValue) Typesafe getter for theLocalDateTime
represented by the provided key.getLocalTime
(String key) Typesafe getter for theLocalTime
represented by the provided key.getLocalTime
(String key, LocalTime defaultValue) Typesafe getter for theLocalTime
represented by the provided key.Typesafe getter for theLong
represented by the provided key.Typesafe getter for theLong
represented by the provided key.JobParameter<?>
getParameter
(String key) Map<String,
JobParameter<?>> Get a map of all parameters.Typesafe getter for theString
represented by the provided key.Typesafe getter for theString
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 aString
key and aJobParameter
value.- Parameters:
parameters
- TheMap
that contains aString
key and aJobParameter
value.
-
-
Method Details
-
getLong
Typesafe getter for theLong
represented by the provided key.- Parameters:
key
- The key for which to get a value.- Returns:
- The
Long
value ornull
if the key is absent.
-
getLong
Typesafe getter for theLong
represented by the provided key. If the key does not exist, the default value is returned.- Parameters:
key
- The key for which to return the value.defaultValue
- The default value to return if the value does not exist.- Returns:
- the parameter represented by the provided key or, if that is missing, the default value.
-
getString
Typesafe getter for theString
represented by the provided key.- Parameters:
key
- The key for which to get a value.- Returns:
- The
String
value ornull
if the key is absent.
-
getString
Typesafe getter for theString
represented by the provided key. If the key does not exist, the default value is returned.- Parameters:
key
- The key for which to return the value.defaultValue
- The defult value to return if the value does not exist.- Returns:
- the parameter represented by the provided key or, if that is missing, the default value.
-
getDouble
Typesafe getter for theDouble
represented by the provided key.- Parameters:
key
- The key for which to get a value.- Returns:
- The
Double
value ornull
if the key is absent.
-
getDouble
Typesafe getter for theDouble
represented by the provided key. If the key does not exist, the default value is returned.- Parameters:
key
- The key for which to return the value.defaultValue
- The default value to return if the value does not exist.- Returns:
- the parameter represented by the provided key or, if that is missing, the default value.
-
getDate
Typesafe getter for theDate
represented by the provided key.- Parameters:
key
- The key for which to get a value.- Returns:
- the
Date
value ornull
if the key is absent.
-
getDate
Typesafe getter for theDate
represented by the provided key. If the key does not exist, the default value is returned.- Parameters:
key
- The key for which to return the value.defaultValue
- The default value to return if the value does not exist.- Returns:
- the parameter represented by the provided key or, if that is missing, the default value.
-
getLocalDate
Typesafe getter for theLocalDate
represented by the provided key.- Parameters:
key
- The key for which to get a value.- Returns:
- the
LocalDate
value ornull
if the key is absent.
-
getLocalDate
Typesafe getter for theLocalDate
represented by the provided key. If the key does not exist, the default value is returned.- Parameters:
key
- The key for which to return the value.defaultValue
- The default value to return if the value does not exist.- Returns:
- the parameter represented by the provided key or, if that is missing, the default value.
-
getLocalTime
Typesafe getter for theLocalTime
represented by the provided key.- Parameters:
key
- The key for which to get a value.- Returns:
- the
LocalTime
value ornull
if the key is absent.
-
getLocalTime
Typesafe getter for theLocalTime
represented by the provided key. If the key does not exist, the default value is returned.- Parameters:
key
- The key for which to return the value.defaultValue
- The default value to return if the value does not exist.- Returns:
- the parameter represented by the provided key or, if that is missing, the default value.
-
getLocalDateTime
Typesafe getter for theLocalDateTime
represented by the provided key.- Parameters:
key
- The key for which to get a value.- Returns:
- the
LocalDateTime
value ornull
if the key is absent.
-
getLocalDateTime
Typesafe getter for theLocalDateTime
represented by the provided key. If the key does not exist, the default value is returned.- Parameters:
key
- The key for which to return the value.defaultValue
- The default value to return if the value does not exist.- Returns:
- the parameter represented by the provided key or, if that is missing, the default value.
-
getParameter
-
getParameters
Get a map of all parameters.- Returns:
- an unmodifiable map containing all parameters.
-
getIdentifyingParameters
Get a map of identifying parameters.- Returns:
- an unmodifiable map containing identifying parameters.
- Since:
- 5.1
-
isEmpty
public boolean isEmpty()- Returns:
true
if the parameters object is empty orfalse
otherwise.
-
equals
-
hashCode
public int hashCode() -
toString
-