All Packages Class Hierarchy This Package Previous Next Index
Classes that are used with the FormatClass element in the XML-DBMS mapping language must implement this interface and provide a no-argument constructor. Such classes sometimes support formatting for only a single type of object, such as Boolean. Other times, they support formatting for a number of object types, such as all numeric types or all date/time types.
This interface uses JDBC Types values to specify the types of the underlying objects. The type mapping is as follows, and corresponds to the default mapping of JDBC types to Java, except for the binary types, which are mapped to ByteArray.
BINARY, VARBINARY, LONGVARBINARY: org.xmlmiddleware.conversions.ByteArray
CHAR, VARCHAR, LONGVARCHAR: String
DATE, TIME, TIMESTAMP: java.sql.Date
BIGINT: Long
INTEGER: Integer
SMALLINT: Short
TINYINT: Byte
DECIMAL, NUMERIC: BigDecimal
DOUBLE, FLOAT: Double
REAL: Float
BIT: Boolean
NOTE: One possible use of custom formatting classes is a to convert binary data to/from Base64. This could easily be done by wrapping a Base64 converter with an Formatter class.
public abstract Object parse(String s, int jdbcType) throws XMLMiddlewareException
public abstract String format(Object o) throws XMLMiddlewareException
The implementing class will generally support only a specific type of object, such as an Integer or a Date.
public abstract boolean canConvert(int type)
This method is generally used by tools to determine whether a given formatter is appropriate for a column.
All Packages Class Hierarchy This Package Previous Next Index