public class StringToDate extends StringToObject
Date
types. Allows the configuration of an explicit date pattern and locale.SimpleDateFormat
Constructor and Description |
---|
StringToDate() |
Modifier and Type | Method and Description |
---|---|
protected java.text.DateFormat |
getDateFormat() |
java.util.Locale |
getLocale()
The locale to use in formatting date values.
|
java.lang.String |
getPattern()
The pattern to use to format date values.
|
void |
setLocale(java.util.Locale locale)
Sets the locale to use in formatting date values.
|
void |
setPattern(java.lang.String pattern)
Sets the pattern to use to format date values.
|
java.lang.Object |
toObject(java.lang.String string,
java.lang.Class targetClass) |
java.lang.String |
toString(java.lang.Object target) |
convertSourceToTargetClass, convertTargetToSourceClass, getSourceClass, getTargetClass
public java.lang.String getPattern()
public void setPattern(java.lang.String pattern)
pattern
- the date formatting patternpublic java.util.Locale getLocale()
LocaleContextHolder.getLocale()
public void setLocale(java.util.Locale locale)
locale
- the localepublic java.lang.Object toObject(java.lang.String string, java.lang.Class targetClass) throws java.lang.Exception
toObject
in class StringToObject
java.lang.Exception
public java.lang.String toString(java.lang.Object target) throws java.lang.Exception
toString
in class StringToObject
java.lang.Exception
protected java.text.DateFormat getDateFormat()