Package com.jidesoft.converter
Class CalendarConverter
java.lang.Object
com.jidesoft.converter.DateConverter
com.jidesoft.converter.CalendarConverter
- All Implemented Interfaces:
ObjectConverter
Converter which converts Calendar to String and converts it back.
-
Field Summary
Fields inherited from class com.jidesoft.converter.DateConverter
DATE_CONTEXT, DATETIME_CONTEXT, TIME_CONTEXT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromString
(String string, ConverterContext context) Converts from a String to a Calendar.toString
(Object object, ConverterContext context) Converts the object to String.Methods inherited from class com.jidesoft.converter.DateConverter
getDefaultDatetimeFormat, getDefaultFormat, getDefaultTimeFormat, setDefaultDatetimeFormat, setDefaultFormat, setDefaultTimeFormat, supportFromString, supportToString
-
Constructor Details
-
CalendarConverter
public CalendarConverter()Creates a new CalendarConverter.
-
-
Method Details
-
toString
Description copied from class:DateConverter
Converts the object to String. The object can be a Calendar, a Date or a Number. As long as the DateFormat can format it correctly, it will be converted to a String. If the object is already a String, we will return it directly as it is.- Specified by:
toString
in interfaceObjectConverter
- Overrides:
toString
in classDateConverter
- Parameters:
object
- the object to be convertedcontext
- the converter context.- Returns:
- the string
-
fromString
Converts from a String to a Calendar.- Specified by:
fromString
in interfaceObjectConverter
- Overrides:
fromString
in classDateConverter
- Parameters:
string
- the string to be converted.context
- the context. It could be DATETIME_CONTEXT, DATE_CONTEXT or TIME_CONTEXT.- Returns:
- the Calendar object. If the string is null or empty, null will be returned. If the string cannot be parsed as a date, the string itself will be returned.
-