net.sourceforge.sqlunit
Interface IType

All Superinterfaces:
java.lang.Comparable
All Known Implementing Classes:
ArrayType, BigDecimalType, BinaryType, BlobType, BooleanType, ByteArrayType, ByteType, ClobType, DateType, DoubleType, FloatType, IntegerType, JavaObjectType, LongType, OracleCursorType, OtherType, ShortType, StringType, TextType, TimestampType, TimeType, UnsupportedType

public interface IType
extends java.lang.Comparable

Interface to be implemented by all SQLUnit datatypes.

Version:
$Revision: 1.5 $
Author:
Ralph Brendler (rblendler@users.sourceforge.net), Sujit Pal (spal@users.sourceforge.net)

Method Summary
 int getId()
          Returns the SQL Type Code for this type.
 java.lang.String getName()
          Returns the XML name for this type.
 java.lang.Object getValue()
          Returns the stored value for this type as an Object.
 void setId(int id)
          Sets the SQL Type Code for this type.
 void setName(java.lang.String name)
          Sets the XML name for this type.
 void setValue(java.lang.Object obj)
          Sets the stored value for this type.
 java.lang.Object toObject(java.lang.String str)
          Parses a String representation of an IType to the corresponding object value.
 java.lang.String toString(java.lang.Object obj)
          Formats an implementation of the IType interface to its corresponding String value.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getName

java.lang.String getName()
Returns the XML name for this type. The XML name is used by SQLUnit to specify the type name in the XML files.

Returns:
the XML name for this type.

setName

void setName(java.lang.String name)
Sets the XML name for this type.

Parameters:
name - the XML name for this type.

getId

int getId()
Returns the SQL Type Code for this type. This is used to refer to a type by the JDBC driver.

Returns:
the SQL Type code for this type.

setId

void setId(int id)
Sets the SQL Type Code for this type.

Parameters:
id - the SQL Type Code for this type.

getValue

java.lang.Object getValue()
Returns the stored value for this type as an Object.

Returns:
the stored value of this type.

setValue

void setValue(java.lang.Object obj)
Sets the stored value for this type.

Parameters:
obj - the value to store in this type.

toObject

java.lang.Object toObject(java.lang.String str)
                          throws SQLUnitException
Parses a String representation of an IType to the corresponding object value. If parsing is succesful, it also stores the parsed value as this type object's value.

Parameters:
str - the String representation of the SQLUnit datatype.
Returns:
an Object which needs to be cast appropriately by caller.
Throws:
SQLUnitException - if the parsing failed.

toString

java.lang.String toString(java.lang.Object obj)
                          throws SQLUnitException
Formats an implementation of the IType interface to its corresponding String value. If formatting is successful, then this method will also store the passed in Object in its native format.

Parameters:
obj - an Object to be converted to the IType interface.
Returns:
the String representation of the object.
Throws:
SQLUnitException - if the formatting failed.