org.dbunit.dataset.datatype
Class AbstractDataType

java.lang.Object
  extended by org.dbunit.dataset.datatype.DataType
      extended by org.dbunit.dataset.datatype.AbstractDataType
Direct Known Subclasses:
BooleanDataType, BytesDataType, DateDataType, DoubleDataType, FloatDataType, IntegerDataType, LongDataType, NumberDataType, StringDataType, TimeDataType, TimestampDataType, UnknownDataType

public abstract class AbstractDataType
extends DataType

Since:
Mar 19, 2002
Version:
$Revision: 461 $
Author:
Manuel Laflamme

Field Summary
 
Fields inherited from class org.dbunit.dataset.datatype.DataType
BIGINT, BINARY, BLOB, BOOLEAN, CHAR, CLOB, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER, LONGVARBINARY, LONGVARCHAR, NUMERIC, REAL, SMALLINT, TIME, TIMESTAMP, TINYINT, UNKNOWN, VARBINARY, VARCHAR
 
Constructor Summary
AbstractDataType(java.lang.String name, int sqlType, java.lang.Class classType, boolean isNumber)
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
 int getSqlType()
          Returns the coresponding Types.
 java.lang.Object getSqlValue(int column, java.sql.ResultSet resultSet)
          Returns the specified column value from the specified resultset object.
 java.lang.Class getTypeClass()
          Returns the runtime class of the typecast result.
 boolean isDateTime()
          Returns true if this DataType represents a date and/or time.
 boolean isNumber()
          Returns true if this DataType represents a number.
 void setSqlValue(java.lang.Object value, int column, java.sql.PreparedStatement statement)
          Set the specified value to the specified prepared statement object.
 java.lang.String toString()
           
 
Methods inherited from class org.dbunit.dataset.datatype.DataType
asString, forObject, forSqlType, forSqlTypeName, typeCast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractDataType

public AbstractDataType(java.lang.String name,
                        int sqlType,
                        java.lang.Class classType,
                        boolean isNumber)
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
            throws TypeCastException
Description copied from class: DataType
Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The two values are typecast to this DataType before being compared.

Specified by:
compare in class DataType
Throws:
TypeCastException - if the arguments' types prevent them from being compared by this Comparator.

getSqlType

public int getSqlType()
Description copied from class: DataType
Returns the coresponding Types.

Specified by:
getSqlType in class DataType

getTypeClass

public java.lang.Class getTypeClass()
Description copied from class: DataType
Returns the runtime class of the typecast result.

Specified by:
getTypeClass in class DataType

isNumber

public boolean isNumber()
Description copied from class: DataType
Returns true if this DataType represents a number.

Specified by:
isNumber in class DataType

isDateTime

public boolean isDateTime()
Description copied from class: DataType
Returns true if this DataType represents a date and/or time.

Specified by:
isDateTime in class DataType

getSqlValue

public java.lang.Object getSqlValue(int column,
                                    java.sql.ResultSet resultSet)
                             throws java.sql.SQLException,
                                    TypeCastException
Description copied from class: DataType
Returns the specified column value from the specified resultset object.

Specified by:
getSqlValue in class DataType
Throws:
java.sql.SQLException
TypeCastException

setSqlValue

public void setSqlValue(java.lang.Object value,
                        int column,
                        java.sql.PreparedStatement statement)
                 throws java.sql.SQLException,
                        TypeCastException
Description copied from class: DataType
Set the specified value to the specified prepared statement object.

Specified by:
setSqlValue in class DataType
Throws:
java.sql.SQLException
TypeCastException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2006. All Rights Reserved.