public class CalendarTypeHandler extends DateTypeHandlerSupport
SimpleDateFormat to parse and format
java.util.Calendar objects. If no pattern is set, DateFormat.getInstance()
is used to create a default date format. By default, lenient is false.Date,
DateFormat,
SimpleDateFormatlenient, pattern, timeZonelocaleFORMAT_SETTINGNIL| Constructor and Description |
|---|
CalendarTypeHandler()
Constructs a new CalendarTypeHandler.
|
CalendarTypeHandler(String pattern)
Constructs a new CalendarTypeHandler.
|
| Modifier and Type | Method and Description |
|---|---|
String |
format(Object value)
Formats a Java object into field text.
|
protected String |
formatCalendar(Calendar calendar) |
Class<?> |
getType()
Returns the class type supported by this handler.
|
Calendar |
parse(String text)
Parses field text into a Java object.
|
createDateFormat, createDefaultDateFormat, formatDate, getPattern, getTimeZone, getTimeZoneId, isLenient, newInstance, parseDate, setLenient, setPattern, setTimeZoneIdgetLocale, setLocalepublic CalendarTypeHandler()
public CalendarTypeHandler(String pattern)
pattern - the SimpleDateFormat patternpublic Calendar parse(String text) throws TypeConversionException
TypeHandlertext - the field text to parse, which may be null if the field was not passed in the recordTypeConversionException - if the text cannot be parsedpublic String format(Object value)
TypeHandlervalue - the Java object to format, which may be nullTypeHandler.NIL for XML formatted streamspublic Class<?> getType()
TypeHandler