All Packages Class Hierarchy This Package Previous Next Index
Class org.xmlmiddleware.conversions.formatters.DateFormatter
java.lang.Object
|
+----org.xmlmiddleware.conversions.formatters.DateFormatter
- public class DateFormatter
- extends Object
- implements StringFormatter
Wraps a DateFormat in an StringFormatter interface.
This can also be used to wrap subclasses of DateFormat, such as SimpleDateFormat.
- Version:
- 2.0
- Author:
- Ronald Bourret, 2001
-
DateFormatter(DateFormat)
-
-
canConvert(int)
- Whether the class can convert to/from a certain type of object.
-
format(Object)
- Format an object according to the format used by the
underlying DateFormat object.
-
getDateFormat()
- Get the underlying DateFormat object.
-
parse(String, int)
- Parse a string according to the parse format used
by the underlying DateFormat object.
DateFormatter
public DateFormatter(DateFormat formatter)
parse
public Object parse(String s,
int jdbcType) throws XMLMiddlewareException
- Parse a string according to the parse format used
by the underlying DateFormat object.
- Parameters:
- The - string to parse.
- A - JDBC Types value indicating the type of object to return.
- Returns:
- A Date.
- Throws: XMLMiddlewareException
- Thrown if the string can't be parsed.
format
public String format(Object o) throws XMLMiddlewareException
- Format an object according to the format used by the
underlying DateFormat object.
- Parameters:
- The - object to serialize. Must be a Date.
- Returns:
- The string
- Throws: XMLMiddlewareException
- Thrown if the object is not a Date.
canConvert
public boolean canConvert(int type)
- Whether the class can convert to/from a certain type of object.
This method returns true for Types.DATE, TIME, and TIMESTAMP.
It returns false for all other types.
- Parameters:
- type - The JDBC Types value corresponding to the object type.
- Returns:
- Whether the type is supported
getDateFormat
public DateFormat getDateFormat()
- Get the underlying DateFormat object.
- Returns:
- The DateFormat object.
All Packages Class Hierarchy This Package Previous Next Index