public abstract class AbstractDataType extends DataType
compare(Object, Object)
method.BIGINT, BIGINT_AUX_LONG, BINARY, BIT, BLOB, BOOLEAN, CHAR, CLOB, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER, LONGNVARCHAR, LONGVARBINARY, LONGVARCHAR, NCHAR, NUMERIC, NVARCHAR, REAL, SMALLINT, TIME, TIMESTAMP, TINYINT, UNKNOWN, VARBINARY, VARCHAR
Constructor and Description |
---|
AbstractDataType(String name,
int sqlType,
Class classType,
boolean isNumber) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
areObjectsEqual(Object o1,
Object o2)
Checks whether the given objects are equal or not.
|
int |
compare(Object o1,
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.
|
protected int |
compareNonNulls(Object value1,
Object value2)
Compares non-null values to each other.
|
int |
getSqlType()
Returns the corresponding
Types . |
Object |
getSqlValue(int column,
ResultSet resultSet)
Returns the specified column value from the specified resultset object.
|
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. |
protected Class |
loadClass(String clazz,
ClassLoader classLoader) |
protected Class |
loadClass(String clazz,
Connection connection) |
void |
setSqlValue(Object value,
int column,
PreparedStatement statement)
Set the specified value to the specified prepared statement object.
|
String |
toString() |
asString, forObject, forSqlType, forSqlTypeName, typeCast
public int compare(Object o1, Object o2) throws TypeCastException
DataType
The two values are typecast to this DataType before being compared.
compare
in class DataType
TypeCastException
- if the arguments' types prevent them from
being compared by this Comparator.protected int compareNonNulls(Object value1, Object value2) throws TypeCastException
Comparable
. The two given objects
are the results of the DataType.typeCast(Object)
method call which is usually
implemented by a specialized DataType
implementation.value1
- First value resulting from the DataType.typeCast(Object)
method callvalue2
- Second value resulting from the DataType.typeCast(Object)
method callComparable.compareTo(Object)
invocation.TypeCastException
protected final boolean areObjectsEqual(Object o1, Object o2)
o1
- first objecto2
- second objecttrue
if both objects are null
(and hence equal)
or if the o1.equals(o2)
is true
.public int getSqlType()
DataType
Types
.getSqlType
in class DataType
public Class getTypeClass()
DataType
getTypeClass
in class DataType
public boolean isNumber()
DataType
true
if this DataType
represents a
number.public boolean isDateTime()
DataType
true
if this DataType
represents a
date and/or time.isDateTime
in class DataType
public Object getSqlValue(int column, ResultSet resultSet) throws SQLException, TypeCastException
DataType
getSqlValue
in class DataType
SQLException
TypeCastException
public void setSqlValue(Object value, int column, PreparedStatement statement) throws SQLException, TypeCastException
DataType
setSqlValue
in class DataType
SQLException
TypeCastException
protected final Class loadClass(String clazz, Connection connection) throws ClassNotFoundException
clazz
- The fully qualified name of the class to be loadedconnection
- The JDBC connection needed to load the given classClassNotFoundException
protected final Class loadClass(String clazz, ClassLoader classLoader) throws ClassNotFoundException
clazz
- The fully qualified name of the class to be loadedclassLoader
- The classLoader to be used to load the given classClassNotFoundException
Copyright © 2002–2015. All rights reserved.