Package org.dbunit.dataset.datatype
Class AbstractDataType
java.lang.Object
org.dbunit.dataset.datatype.DataType
org.dbunit.dataset.datatype.AbstractDataType
- Direct Known Subclasses:
BigIntegerDataType,BooleanDataType,BytesDataType,CitextType,DateDataType,DateTimeOffsetType,DoubleDataType,FloatDataType,GenericEnumType,GeometryType,InetType,IntegerDataType,IntervalType,LongDataType,NumberDataType,OracleSdoGeometryDataType,StringDataType,TimeDataType,TimestampDataType,UniqueIdentifierType,UnknownDataType,UuidType
Abstract data type implementation that provides generic methods that are
appropriate for most data type implementations. Among those is the generic
implementation of the
compare(Object, Object) method.- Since:
- Mar 19, 2002
- Version:
- $Revision$ $Date$
- Author:
- Manuel Laflamme, Last changed by: $Author$
-
Field Summary
Fields inherited from class org.dbunit.dataset.datatype.DataType
BIGINT, BIGINT_AUX_LONG, BINARY, BIT, BLOB, BOOLEAN, CHAR, CLOB, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER, LONGNVARCHAR, LONGVARBINARY, LONGVARCHAR, NCHAR, NUMERIC, NVARCHAR, REAL, RELATIVE_DATE_TIME_PARSER, SMALLINT, TIME, TIMESTAMP, TINYINT, UNKNOWN, VARBINARY, VARCHAR -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDataType(String name, int sqlType, Class classType, boolean isNumber) -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanareObjectsEqual(Object o1, Object o2) Checks whether the given objects are equal or not.intReturns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.protected intcompareNonNulls(Object value1, Object value2) Compares non-null values to each other.intReturns the correspondingTypes.getSqlValue(int column, ResultSet resultSet) Returns the specified column value from the specified resultset object.Returns the runtime class of the typecast result.booleanReturnstrueif thisDataTyperepresents a date and/or time.booleanisNumber()Returnstrueif thisDataTyperepresents a number.protected final ClassloadClass(String clazz, ClassLoader classLoader) protected final ClassloadClass(String clazz, Connection connection) voidsetSqlValue(Object value, int column, PreparedStatement statement) Set the specified value to the specified prepared statement object.toString()Methods inherited from class org.dbunit.dataset.datatype.DataType
asString, forObject, forSqlType, forSqlTypeName, getSqlTypeName, isExtendedSyntax, typeCast
-
Constructor Details
-
AbstractDataType
-
-
Method Details
-
compare
Description copied from class:DataTypeReturns 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:
comparein classDataType- Throws:
TypeCastException- if the arguments' types prevent them from being compared by this Comparator.
-
compareNonNulls
Compares non-null values to each other. Both objects are guaranteed to be not null and to implement the interfaceComparable. The two given objects are the results of theDataType.typeCast(Object)method call which is usually implemented by a specializedDataTypeimplementation.- Parameters:
value1- First value resulting from theDataType.typeCast(Object)method callvalue2- Second value resulting from theDataType.typeCast(Object)method call- Returns:
- The result of the
Comparable.compareTo(Object)invocation. - Throws:
TypeCastException
-
areObjectsEqual
Checks whether the given objects are equal or not.- Parameters:
o1- first objecto2- second object- Returns:
trueif both objects arenull(and hence equal) or if theo1.equals(o2)istrue.
-
getSqlType
public int getSqlType()Description copied from class:DataTypeReturns the correspondingTypes.- Specified by:
getSqlTypein classDataType
-
getTypeClass
Description copied from class:DataTypeReturns the runtime class of the typecast result.- Specified by:
getTypeClassin classDataType
-
isNumber
public boolean isNumber()Description copied from class:DataTypeReturnstrueif thisDataTyperepresents a number. -
isDateTime
public boolean isDateTime()Description copied from class:DataTypeReturnstrueif thisDataTyperepresents a date and/or time.- Specified by:
isDateTimein classDataType
-
getSqlValue
Description copied from class:DataTypeReturns the specified column value from the specified resultset object.- Specified by:
getSqlValuein classDataType- Throws:
SQLExceptionTypeCastException
-
setSqlValue
public void setSqlValue(Object value, int column, PreparedStatement statement) throws SQLException, TypeCastException Description copied from class:DataTypeSet the specified value to the specified prepared statement object.- Specified by:
setSqlValuein classDataType- Throws:
SQLExceptionTypeCastException
-
loadClass
- Parameters:
clazz- The fully qualified name of the class to be loadedconnection- The JDBC connection needed to load the given class- Returns:
- The loaded class
- Throws:
ClassNotFoundException
-
loadClass
protected final Class loadClass(String clazz, ClassLoader classLoader) throws ClassNotFoundException - Parameters:
clazz- The fully qualified name of the class to be loadedclassLoader- The classLoader to be used to load the given class- Returns:
- The loaded class
- Throws:
ClassNotFoundException
-
toString
-