com.jidesoft.converter
Class CalendarConverter
java.lang.Object
com.jidesoft.converter.DateConverter
com.jidesoft.converter.CalendarConverter
- All Implemented Interfaces:
- ObjectConverter
public class CalendarConverter
- extends DateConverter
Converter which converts Calendar to String and converts it back.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CalendarConverter
public CalendarConverter()
- Creates a new CalendarConverter.
toString
public String toString(Object object,
ConverterContext context)
- 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 interface ObjectConverter
- Overrides:
toString
in class DateConverter
- Parameters:
object
- the object to be convertedcontext
- the converter context.
- Returns:
- the string
fromString
public Object fromString(String string,
ConverterContext context)
- Converts from a String to a Calendar.
- Specified by:
fromString
in interface ObjectConverter
- Overrides:
fromString
in class DateConverter
- 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.