org.dbunit.dataset.datatype
Class DefaultDataTypeFactory

java.lang.Object
  extended by org.dbunit.dataset.datatype.DefaultDataTypeFactory
All Implemented Interfaces:
IDataTypeFactory, IDbProductRelatable
Direct Known Subclasses:
Db2DataTypeFactory, H2DataTypeFactory, HsqldbDataTypeFactory, MckoiDataTypeFactory, MsSqlDataTypeFactory, MySqlDataTypeFactory, NetezzaDataTypeFactory, OracleDataTypeFactory, PostgresqlDataTypeFactory

public class DefaultDataTypeFactory
extends Object
implements IDataTypeFactory, IDbProductRelatable

Generic factory that handle standard JDBC types.

Since:
May 17, 2003
Version:
$Revision: 1031 $
Author:
Manuel Laflamme

Constructor Summary
DefaultDataTypeFactory()
           
 
Method Summary
 void addToleratedDelta(ToleratedDeltaMap.ToleratedDelta delta)
          Adds a tolerated delta to this data type factory to be used for numeric comparisons
 DataType createDataType(int sqlType, String sqlTypeName)
          Returns the DataType object that corresponds to the specified Types.
 DataType createDataType(int sqlType, String sqlTypeName, String tableName, String columnName)
          Returns the DataType object that corresponds to the specified Types and regards the given tableName and columnName.
 ToleratedDeltaMap getToleratedDeltaMap()
           
 Collection getValidDbProducts()
          Returns a set of Strings representing database product names that this object relates to.
 String toString()
          Returns a string representation of this DefaultDataTypeFactory instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultDataTypeFactory

public DefaultDataTypeFactory()
Method Detail

getValidDbProducts

public Collection getValidDbProducts()
Description copied from interface: IDbProductRelatable
Returns a set of Strings representing database product names that this object relates to.

Specified by:
getValidDbProducts in interface IDbProductRelatable
Returns:
Set of Strings.
See Also:
IDbProductRelatable.getValidDbProducts()

createDataType

public DataType createDataType(int sqlType,
                               String sqlTypeName)
                        throws DataTypeException
Description copied from interface: IDataTypeFactory
Returns the DataType object that corresponds to the specified Types.

Specified by:
createDataType in interface IDataTypeFactory
Parameters:
sqlType - SQL type from Types
sqlTypeName - Data source dependent type name
Throws:
DataTypeException
See Also:
IDataTypeFactory.createDataType(int, java.lang.String)

createDataType

public DataType createDataType(int sqlType,
                               String sqlTypeName,
                               String tableName,
                               String columnName)
                        throws DataTypeException
Description copied from interface: IDataTypeFactory
Returns the DataType object that corresponds to the specified Types and regards the given tableName and columnName. When a ToleratedDeltaMap.ToleratedDelta has been set for a tableName.columnName set then this method automatically creates the correct datatype that honours the tolerance value in the assertion.

Specified by:
createDataType in interface IDataTypeFactory
Parameters:
sqlType - SQL type from Types
sqlTypeName - Data source dependent type name
tableName - The database table for which the type is created
columnName - The database column in the given table for which the type is created
Throws:
DataTypeException
See Also:
IDataTypeFactory.createDataType(int, java.lang.String, java.lang.String, java.lang.String)

getToleratedDeltaMap

public ToleratedDeltaMap getToleratedDeltaMap()
Returns:
The whole map of tolerated delta objects that have been set until now
Since:
2.3.0

addToleratedDelta

public void addToleratedDelta(ToleratedDeltaMap.ToleratedDelta delta)
Adds a tolerated delta to this data type factory to be used for numeric comparisons

Parameters:
delta - The new tolerated delta object
Since:
2.3.0

toString

public String toString()
Returns a string representation of this DefaultDataTypeFactory instance

Overrides:
toString in class Object
Since:
2.4.6


Copyright © 2002-2012. All Rights Reserved.