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

Constructor Index

 o DateFormatter(DateFormat)

Method Index

 o canConvert(int)
Whether the class can convert to/from a certain type of object.
 o format(Object)
Format an object according to the format used by the underlying DateFormat object.
 o getDateFormat()
Get the underlying DateFormat object.
 o parse(String, int)
Parse a string according to the parse format used by the underlying DateFormat object.

Constructors

 o DateFormatter
 public DateFormatter(DateFormat formatter)

Methods

 o 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.
 o 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.
 o 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
 o getDateFormat
 public DateFormat getDateFormat()
Get the underlying DateFormat object.

Returns:
The DateFormat object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index