|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 String |
DATE_TYPE
|
static String |
LONG_TYPE
|
static String |
STRING_TYPE
|
Constructor Summary | |
---|---|
DefaultJobParametersConverter()
|
Method Summary | |
---|---|
JobParameters |
getJobParameters(Properties props)
Check for suffix on keys and use those to decide how to convert the value. |
Properties |
getProperties(JobParameters params)
Use the same suffixes to create properties (omitting the string suffix because it is the default). |
void |
setDateFormat(DateFormat dateFormat)
Public setter for injecting a date format. |
void |
setNumberFormat(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 String DATE_TYPE
public static final String STRING_TYPE
public static final String LONG_TYPE
Constructor Detail |
---|
public DefaultJobParametersConverter()
Method Detail |
---|
public JobParameters getJobParameters(Properties props)
getJobParameters
in interface JobParametersConverter
props
- the runtime parameters in the form of String literals.
JobParameters
properties converted to the correct
types.
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 Properties getProperties(JobParameters params)
getProperties
in interface JobParametersConverter
JobParametersConverter.getProperties(org.springframework.batch.core.JobParameters)
public void setDateFormat(DateFormat dateFormat)
dateFormat
- a DateFormat
, defaults to "yyyy/MM/dd"public void setNumberFormat(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 |