public class ExpandedJobParametersConverter
extends org.springframework.batch.core.converter.DefaultJobParametersConverter
JobParametersConverter. Allows to convert a wide variety of object types
to JobParameters.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ABSOLUTE_FILE_PATH |
protected org.apache.commons.logging.Log |
logger |
static java.lang.String |
UNIQUE_JOB_PARAMETER_KEY |
| Constructor and Description |
|---|
ExpandedJobParametersConverter() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.batch.core.JobParameters |
getJobParameters(java.util.Properties properties)
If
makeParametersUnique is true the JobParameter with key
UNIQUE_JOB_PARAMETER_KEY will be added with a random number value. |
org.springframework.batch.core.JobParameters |
getJobParametersForFile(java.io.File file)
Return
JobParameters for the passed-in File. |
org.springframework.batch.core.JobParameters |
getJobParametersForJsonString(java.lang.String jobParametersAsJsonMap)
Converts a
String-based JSON map to JobParameters. |
org.springframework.batch.core.JobParameters |
getJobParametersForMap(java.util.Map<?,?> map)
Will convert the provided
Map into JobParameters. |
void |
setDateFormat(java.text.DateFormat dateFormat)
Will set the
DateFormat on the underlying DefaultJobParametersConverter. |
void |
setDateFormatAsString(java.lang.String dateFormatAsString)
Allows for setting the
DateFormat using a String. |
void |
setMakeParametersUnique(boolean makeParametersUnique)
If not set, this property defaults to
true. |
void |
setNumberFormat(java.text.NumberFormat numberFormat)
Setter for the
NumberFormat which is set on the underlying DefaultJobParametersConverter. |
void |
setNumberFormatAsString(java.lang.String numberFormatAsString)
Allows for setting the
NumberFormat using a String. |
protected final org.apache.commons.logging.Log logger
public static final java.lang.String ABSOLUTE_FILE_PATH
public static final java.lang.String UNIQUE_JOB_PARAMETER_KEY
public void setDateFormat(java.text.DateFormat dateFormat)
DateFormat on the underlying DefaultJobParametersConverter. If not set explicitly
the DateFormat will default to "yyyy/MM/dd".setDateFormat in class org.springframework.batch.core.converter.DefaultJobParametersConverterdateFormat - Must not be nullpublic void setDateFormatAsString(java.lang.String dateFormatAsString)
DateFormat using a String.dateFormatAsString - Will be ignored if null or empty.public void setMakeParametersUnique(boolean makeParametersUnique)
true.makeParametersUnique - If not set defaults to truepublic void setNumberFormat(java.text.NumberFormat numberFormat)
NumberFormat which is set on the underlying DefaultJobParametersConverter. If not
set explicitly, defaults to NumberFormat.getInstance(Locale.US);setNumberFormat in class org.springframework.batch.core.converter.DefaultJobParametersConverternumberFormat - Must not be null.public void setNumberFormatAsString(java.lang.String numberFormatAsString)
NumberFormat using a String. The passed-in String will be converted to a
DecimalFormat.numberFormatAsString - Will be ignored if null or empty.public org.springframework.batch.core.JobParameters getJobParametersForFile(java.io.File file)
JobParameters for the passed-in File. Will set the JobParameter with key
ABSOLUTE_FILE_PATH to the File's absolutePath. Method will ultimately call
getJobParameters(Properties).file - Must not be null.public org.springframework.batch.core.JobParameters getJobParametersForJsonString(java.lang.String jobParametersAsJsonMap)
String-based JSON map to JobParameters. The String is converted using Jackson's
ObjectMapper.
The method will ultimately call getJobParametersForMap(Map).jobParametersAsJsonMap - Can be null or empty.public org.springframework.batch.core.JobParameters getJobParametersForMap(java.util.Map<?,?> map)
Map into JobParameters. The method will ultimately call
getJobParameters(Properties).map - Can be null or an empty Map.public org.springframework.batch.core.JobParameters getJobParameters(java.util.Properties properties)
makeParametersUnique is true the JobParameter with key
UNIQUE_JOB_PARAMETER_KEY will be added with a random number value.
The method will ultimately call DefaultJobParametersConverter.getJobParameters(Properties).getJobParameters in interface org.springframework.batch.core.converter.JobParametersConvertergetJobParameters in class org.springframework.batch.core.converter.DefaultJobParametersConverterproperties - Can be null.