Class StringToDate
java.lang.Object
org.springframework.binding.convert.converters.StringToObject
org.springframework.binding.convert.converters.StringToDate
- All Implemented Interfaces:
Converter
,TwoWayConverter
A formatter for
Date
types. Allows the configuration of an explicit date pattern and locale.- Author:
- Keith Donald
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected DateFormat
The locale to use in formatting date values.The pattern to use to format date values.void
Sets the locale to use in formatting date values.void
setPattern
(String pattern) Sets the pattern to use to format date values.Methods inherited from class org.springframework.binding.convert.converters.StringToObject
convertSourceToTargetClass, convertTargetToSourceClass, getSourceClass, getTargetClass
-
Constructor Details
-
StringToDate
public StringToDate()
-
-
Method Details
-
getPattern
The pattern to use to format date values. If not specified, the default pattern 'yyyy-MM-dd' is used.- Returns:
- the date formatting pattern
-
setPattern
Sets the pattern to use to format date values.- Parameters:
pattern
- the date formatting pattern
-
getLocale
The locale to use in formatting date values. If not specified, the locale of the current thread is used.- Returns:
- the locale
- See Also:
-
LocaleContextHolder.getLocale()
-
setLocale
Sets the locale to use in formatting date values.- Parameters:
locale
- the locale
-
toObject
- Specified by:
toObject
in classStringToObject
-
toString
- Specified by:
toString
in classStringToObject
-
getDateFormat
-