|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.core.converter.DefaultJobParametersConverter
public class DefaultJobParametersConverter
Converter for JobParameters instances using a simple naming
convention for property keys. Key names ending with "(<type>)" where
type is one of string, date, long are converted to the corresponding type.
The default type is string. E.g.
schedule.date(date)=2007/12/11 department.id(long)=2345The literal values are converted to the correct type using the default Spring strategies, augmented if necessary by the custom editors provided.
| Field Summary | |
|---|---|
static java.lang.String |
DATE_TYPE
|
static java.lang.String |
LONG_TYPE
|
static java.lang.String |
STRING_TYPE
|
| Constructor Summary | |
|---|---|
DefaultJobParametersConverter()
|
|
| Method Summary | |
|---|---|
JobParameters |
getJobParameters(java.util.Properties props)
Check for suffix on keys and use those to decide how to convert the value. |
java.util.Properties |
getProperties(JobParameters params)
Use the same suffixes to create properties (omitting the string suffix because it is the default). |
void |
setDateFormat(java.text.DateFormat dateFormat)
Public setter for injecting a date format. |
void |
setNumberFormat(java.text.NumberFormat numberFormat)
Public setter for the NumberFormat. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DATE_TYPE
public static final java.lang.String STRING_TYPE
public static final java.lang.String LONG_TYPE
| Constructor Detail |
|---|
public DefaultJobParametersConverter()
| Method Detail |
|---|
public JobParameters getJobParameters(java.util.Properties props)
getJobParameters in interface JobParametersConverterprops - the runtime parameters in the form of String literals.
JobParameters properties converted to the correct
types.
java.lang.IllegalArgumentException - if a number or date is passed in that
cannot be parsed, or cast to the correct type.JobParametersConverter.getJobParameters(java.util.Properties)public java.util.Properties getProperties(JobParameters params)
getProperties in interface JobParametersConverterJobParametersConverter.getProperties(org.springframework.batch.core.JobParameters)public void setDateFormat(java.text.DateFormat dateFormat)
dateFormat - a DateFormat, defaults to "yyyy/MM/dd"public void setNumberFormat(java.text.NumberFormat numberFormat)
NumberFormat. Used to parse longs, so must
not contain decimal place (e.g. use "#" or "#,###").
numberFormat - the NumberFormat to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||