Package org.dbunit.dataset.datatype
Class DataType
java.lang.Object
org.dbunit.dataset.datatype.DataType
- Direct Known Subclasses:
AbstractDataType
Data type that maps
Types objects to their java
counterparts. It also provides immutable constants for the most common data
types.- Version:
- $Revision$
- Author:
- Manuel Laflamme
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DataTypestatic final DataTypeAuxiliary for the BIGINT type using a long.static final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final RelativeDateTimeParserstatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataTypestatic final DataType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringTypecast the specified value to string.abstract intReturns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.static DataTypeReturns theDataTypecorresponding to the specified value runtime class.static DataTypeforSqlType(int sqlType) Returns theDataTypecorresponding to the specified Sql type.static DataTypeforSqlTypeName(String sqlTypeName) Deprecated.Should not be used anymoreabstract intReturns the correspondingTypes.Returns the SQL type name for user types (null for basic SQL types)abstract ObjectgetSqlValue(int column, ResultSet resultSet) Returns the specified column value from the specified resultset object.abstract ClassReturns the runtime class of the typecast result.abstract booleanReturnstrueif thisDataTyperepresents a date and/or time.protected static booleanisExtendedSyntax(String input) Performs a quick check to test if the specified string uses extended syntax.abstract booleanisNumber()Returnstrueif thisDataTyperepresents a number.abstract voidsetSqlValue(Object value, int column, PreparedStatement statement) Set the specified value to the specified prepared statement object.abstract ObjectReturns the specified value typecasted to thisDataType
-
Field Details
-
UNKNOWN
-
CHAR
-
VARCHAR
-
LONGVARCHAR
-
CLOB
-
NUMERIC
-
DECIMAL
-
BOOLEAN
-
BIT
-
TINYINT
-
SMALLINT
-
INTEGER
-
BIGINT
-
BIGINT_AUX_LONG
Auxiliary for the BIGINT type using a long. Is currently only needed for methodforObject(Object). -
REAL
-
FLOAT
-
DOUBLE
-
RELATIVE_DATE_TIME_PARSER
-
DATE
-
TIME
-
TIMESTAMP
-
BINARY
-
VARBINARY
-
LONGVARBINARY
-
BLOB
-
NCHAR
-
NVARCHAR
-
LONGNVARCHAR
-
-
Constructor Details
-
DataType
public DataType()
-
-
Method Details
-
typeCast
Returns the specified value typecasted to thisDataType- Throws:
TypeCastException
-
compare
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.
- Throws:
TypeCastException- if the arguments' types prevent them from being compared by this Comparator.
-
getSqlType
public abstract int getSqlType()Returns the correspondingTypes. -
getTypeClass
Returns the runtime class of the typecast result. -
getSqlTypeName
Returns the SQL type name for user types (null for basic SQL types) -
isNumber
public abstract boolean isNumber()Returnstrueif thisDataTyperepresents a number. -
isDateTime
public abstract boolean isDateTime()Returnstrueif thisDataTyperepresents a date and/or time. -
getSqlValue
public abstract Object getSqlValue(int column, ResultSet resultSet) throws SQLException, TypeCastException Returns the specified column value from the specified resultset object.- Throws:
SQLExceptionTypeCastException
-
setSqlValue
public abstract void setSqlValue(Object value, int column, PreparedStatement statement) throws SQLException, TypeCastException Set the specified value to the specified prepared statement object.- Throws:
SQLExceptionTypeCastException
-
asString
Typecast the specified value to string.- Throws:
TypeCastException
-
forSqlType
Returns theDataTypecorresponding to the specified Sql type. SeeTypes.- Throws:
DataTypeException
-
forSqlTypeName
Deprecated.Should not be used anymoreReturns theDataTypecorresponding to the specified Sql type name.- Throws:
DataTypeException
-
forObject
Returns theDataTypecorresponding to the specified value runtime class. This method returnsDataType.UNKNOWNif the value isnullor runtime class not recognized. -
isExtendedSyntax
Performs a quick check to test if the specified string uses extended syntax.- Parameters:
input- a string to check.- Returns:
trueif the input uses extended syntax;falseotherwise.
-