JIDE 3.5.15

com.jidesoft.converter
Class CalendarConverter

java.lang.Object
  extended by com.jidesoft.converter.DateConverter
      extended by com.jidesoft.converter.CalendarConverter
All Implemented Interfaces:
ObjectConverter

public class CalendarConverter
extends DateConverter

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
CalendarConverter()
          Creates a new CalendarConverter.
 
Method Summary
 Object fromString(String string, ConverterContext context)
          Converts from a String to a Calendar.
 String 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalendarConverter

public CalendarConverter()
Creates a new CalendarConverter.

Method Detail

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 converted
context - 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.

JIDE 3.5.15