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
ConstructorsConstructorDescriptionDefault constructor.JobParameters(Map<String, JobParameter<?>> parameters) Constructor that is initialized with the content of aMapthat contains aStringkey and aJobParametervalue. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTypesafe getter for theDaterepresented by the provided key.Typesafe getter for theDaterepresented by the provided key.Typesafe getter for theDoublerepresented by the provided key.Typesafe getter for theDoublerepresented by the provided key.Map<String,JobParameter<?>> Get a map of identifying parameters.getLocalDate(String key) Typesafe getter for theLocalDaterepresented by the provided key.getLocalDate(String key, LocalDate defaultValue) Typesafe getter for theLocalDaterepresented by the provided key.getLocalDateTime(String key) Typesafe getter for theLocalDateTimerepresented by the provided key.getLocalDateTime(String key, LocalDateTime defaultValue) Typesafe getter for theLocalDateTimerepresented by the provided key.getLocalTime(String key) Typesafe getter for theLocalTimerepresented by the provided key.getLocalTime(String key, LocalTime defaultValue) Typesafe getter for theLocalTimerepresented by the provided key.Typesafe getter for theLongrepresented by the provided key.Typesafe getter for theLongrepresented by the provided key.JobParameter<?>getParameter(String key) Map<String,JobParameter<?>> Get a map of all parameters.Typesafe getter for theStringrepresented by the provided key.Typesafe getter for theStringrepresented by the provided key.inthashCode()booleanisEmpty()toString()
-
Constructor Details
-
JobParameters
public JobParameters()Default constructor. -
JobParameters
Constructor that is initialized with the content of aMapthat contains aStringkey and aJobParametervalue.- Parameters:
parameters- TheMapthat contains aStringkey and aJobParametervalue.
-
-
Method Details
-
getLong
Typesafe getter for theLongrepresented by the provided key.- Parameters:
key- The key for which to get a value.- Returns:
- The
Longvalue ornullif the key is absent.
-
getLong
Typesafe getter for theLongrepresented 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 theStringrepresented by the provided key.- Parameters:
key- The key for which to get a value.- Returns:
- The
Stringvalue ornullif the key is absent.
-
getString
Typesafe getter for theStringrepresented 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 theDoublerepresented by the provided key.- Parameters:
key- The key for which to get a value.- Returns:
- The
Doublevalue ornullif the key is absent.
-
getDouble
Typesafe getter for theDoublerepresented 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 theDaterepresented by the provided key.- Parameters:
key- The key for which to get a value.- Returns:
- the
Datevalue ornullif the key is absent.
-
getDate
Typesafe getter for theDaterepresented 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 theLocalDaterepresented by the provided key.- Parameters:
key- The key for which to get a value.- Returns:
- the
LocalDatevalue ornullif the key is absent.
-
getLocalDate
Typesafe getter for theLocalDaterepresented 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 theLocalTimerepresented by the provided key.- Parameters:
key- The key for which to get a value.- Returns:
- the
LocalTimevalue ornullif the key is absent.
-
getLocalTime
Typesafe getter for theLocalTimerepresented 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 theLocalDateTimerepresented by the provided key.- Parameters:
key- The key for which to get a value.- Returns:
- the
LocalDateTimevalue ornullif the key is absent.
-
getLocalDateTime
Typesafe getter for theLocalDateTimerepresented 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:
trueif the parameters object is empty orfalseotherwise.
-
equals
-
hashCode
public int hashCode() -
toString
-