public abstract class BaseDataType extends java.lang.Object implements DataType, DataTypeFactory
DataType.DataType.BinaryRepresentation, DataType.ExactNumeric, DataType.NonFixedPrecision| Constructor and Description |
|---|
BaseDataType() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
accepts(java.lang.Object value)
Return
true if a field of my type can be assigned the given non-
null value , false otherwise. |
int |
compare(java.lang.Object a,
java.lang.Object b) |
abstract java.lang.Object |
convert(java.lang.Object value)
Converts an
acceptablevalue to one of the appropriate type. |
int |
getColumnDisplaySize()
Value returned by
ResultSetMetaData#getColumnDisplaySizefor this data
type. |
protected java.util.Comparator |
getComparator()
This base implementation simply returns a
ComparableComparator. |
abstract int |
getJdbcType()
Returns the JDBC
type codemost closely matching this type. |
java.lang.String |
getLiteralPrefix()
Prefix used to quote a literal to delimit value for this type when in SQL syntax or
result display
|
java.lang.String |
getLiteralSuffix()
Suffix used to quote a literal to delimit value for this type when in SQL syntax or
result display
|
int |
getNullableCode()
Code indicating that type does not accept, does accept, or does not disclose
acceptance of
null values |
int |
getPrecision()
Value returned by
ResultSetMetaData#getPrecisionfor this data type. |
int |
getPrecisionRadix()
Indicates radix used to compute maximum number of significant digits for this
datatype, as returned by
DataType.getPrecision(). |
java.lang.String |
getPreferredValueClassName()
Returns the "normal" type returned by
DataType.convert(java.lang.Object). |
int |
getScale()
Value returned by
ResultSetMetaData#getScalefor this data type. |
short |
getSearchableCode()
Code indicating how much
WHERE ... |
boolean |
isCaseSensitive()
For character and string-related types, indicates whether type acknowledges case
when storing and retrieving values
|
boolean |
isCurrency() |
boolean |
isUnsigned()
For numeric types, indicates whether type stores only non-negative (>= 0) values
|
abstract DataType |
makeNewInstance()
Creates a new instance of this DataType implementation.
|
abstract java.lang.Object |
read(java.io.DataInput in)
Instantiate an object of my type from the given
DataInput. |
java.lang.Object |
successor(java.lang.Object value)
Returns the successor for the given value.
|
boolean |
supportsSuccessor()
Returns
true if the DataType.successor(java.lang.Object)method is supported, false
otherwise. |
java.math.BigDecimal |
toBigDecimal(java.lang.Object value)
|
java.math.BigInteger |
toBigInteger(java.lang.Object value)
|
java.sql.Blob |
toBlob(java.lang.Object value)
|
boolean |
toBoolean(java.lang.Object value)
Convert the given non-
null value to a boolean,
or throw a SQLException. |
byte |
toByte(java.lang.Object value)
Convert the given non-
null value to a byte,
or throw a SQLException. |
byte[] |
toByteArray(java.lang.Object value)
|
java.sql.Clob |
toClob(java.lang.Object value)
|
java.sql.Date |
toDate(java.lang.Object value)
Convert the given non-
null value to a Date,
or throw a SQLException. |
double |
toDouble(java.lang.Object value)
|
float |
toFloat(java.lang.Object value)
|
int |
toInt(java.lang.Object value)
|
long |
toLong(java.lang.Object value)
|
protected java.lang.Number |
toNumber(java.lang.Object value) |
short |
toShort(java.lang.Object value)
|
java.lang.String |
toString(java.lang.Object value)
|
java.sql.Time |
toTime(java.lang.Object value)
|
java.sql.Timestamp |
toTimestamp(java.lang.Object value)
|
java.net.URL |
toURL(java.lang.Object value)
|
abstract void |
write(java.lang.Object value,
java.io.DataOutput out)
Write an object of my type to the given
DataOutput. |
public abstract DataType makeNewInstance()
DataTypemakeNewInstance in interface DataTypemakeNewInstance in interface DataTypeFactorypublic abstract boolean accepts(java.lang.Object value)
DataTypetrue if a field of my type can be assigned the given non-
null value , false otherwise.public abstract java.lang.Object convert(java.lang.Object value)
throws AxionException
DataTypeacceptablevalue to one of the appropriate type.convert in interface DataTypeAxionExceptionpublic abstract java.lang.Object read(java.io.DataInput in)
throws java.io.IOException
DataTypeDataInput. The next
sequence of bytes to be read from the DataInput will have been
written by DataType.write(java.lang.Object, java.io.DataOutput).public abstract void write(java.lang.Object value,
java.io.DataOutput out)
throws java.io.IOException
DataTypeDataOutput.write in interface DataTypevalue - the value to write, which must be acceptableto this
DataTypejava.io.IOExceptionpublic abstract int getJdbcType()
DataTypetype codemost closely matching this type.getJdbcType in interface DataTypepublic java.lang.String getPreferredValueClassName()
DataTypeDataType.convert(java.lang.Object). Returns
java.lang.Object if unknown.getPreferredValueClassName in interface DataTypeAxionResultSetMetaData.getColumnClassName(int)public int compare(java.lang.Object a,
java.lang.Object b)
compare in interface java.util.Comparatorprotected java.util.Comparator getComparator()
ComparableComparator.public int getColumnDisplaySize()
DataTypeResultSetMetaData#getColumnDisplaySizefor this data
type.getColumnDisplaySize in interface DataTypeResultSetMetaData.getColumnDisplaySize(int)public int getPrecision()
DataTypeResultSetMetaData#getPrecisionfor this data type.getPrecision in interface DataTypeResultSetMetaData.getPrecision(int)public int getScale()
DataTypeResultSetMetaData#getScalefor this data type.public boolean isCaseSensitive()
DataTypeisCaseSensitive in interface DataTypeDatabaseMetaData.getTypeInfo(),
ResultSetMetaData.isCaseSensitive(int)public boolean isCurrency()
isCurrency in interface DataTypeResultSetMetaData.isCurrency(int)public java.lang.String getLiteralPrefix()
DataTypegetLiteralPrefix in interface DataTypeDatabaseMetaData.getTypeInfo()public java.lang.String getLiteralSuffix()
DataTypegetLiteralSuffix in interface DataTypeDatabaseMetaData.getTypeInfo()public int getNullableCode()
DataTypenull valuesgetNullableCode in interface DataTypeDatabaseMetaData.getTypeInfo()public short getSearchableCode()
DataTypeWHERE ... LIKE support is available across
a column of this typegetSearchableCode in interface DataTypeDatabaseMetaData.getTypeInfo()public boolean isUnsigned()
DataTypeisUnsigned in interface DataTypeDatabaseMetaData.getTypeInfo()public boolean supportsSuccessor()
DataTypetrue if the DataType.successor(java.lang.Object)method is supported, false
otherwise.supportsSuccessor in interface DataTypepublic java.lang.Object successor(java.lang.Object value)
throws java.lang.IllegalArgumentException
DataTypepublic int getPrecisionRadix()
DataTypeDataType.getPrecision().getPrecisionRadix in interface DataTypeDataType.getPrecision(), typically 2 or 10.protected java.lang.Number toNumber(java.lang.Object value)
throws AxionException
AxionExceptionpublic java.math.BigDecimal toBigDecimal(java.lang.Object value)
throws AxionException
DataTypetoBigDecimal in interface DataTypeAxionExceptionResultSet.getBigDecimal(int, int)public java.math.BigInteger toBigInteger(java.lang.Object value)
throws AxionException
DataTypetoBigInteger in interface DataTypeAxionExceptionjava.sql.ResultSet#getBigIntegerpublic boolean toBoolean(java.lang.Object value)
throws AxionException
DataTypenull value to a boolean,
or throw a SQLException.toBoolean in interface DataTypeAxionExceptionResultSet.getBoolean(int)public byte toByte(java.lang.Object value)
throws AxionException
DataTypenull value to a byte,
or throw a SQLException.toByte in interface DataTypeAxionExceptionResultSet.getByte(int)public byte[] toByteArray(java.lang.Object value)
throws AxionException
DataTypetoByteArray in interface DataTypeAxionExceptionResultSet.getBytes(int)public java.sql.Date toDate(java.lang.Object value)
throws AxionException
DataTypenull value to a Date,
or throw a SQLException.toDate in interface DataTypeAxionExceptionResultSet.getDate(int)public double toDouble(java.lang.Object value)
throws AxionException
DataTypetoDouble in interface DataTypeAxionExceptionResultSet.getDouble(int)public float toFloat(java.lang.Object value)
throws AxionException
DataTypetoFloat in interface DataTypeAxionExceptionResultSet.getFloat(int)public int toInt(java.lang.Object value)
throws AxionException
DataTypetoInt in interface DataTypeAxionExceptionResultSet.getInt(int)public long toLong(java.lang.Object value)
throws AxionException
DataTypetoLong in interface DataTypeAxionExceptionResultSet.getLong(int)public short toShort(java.lang.Object value)
throws AxionException
DataTypetoShort in interface DataTypeAxionExceptionResultSet.getShort(int)public java.lang.String toString(java.lang.Object value)
throws AxionException
DataTypetoString in interface DataTypeAxionExceptionResultSet.getString(int)public java.net.URL toURL(java.lang.Object value)
throws AxionException
DataTypetoURL in interface DataTypeAxionExceptionResultSet.getURL(int)public java.sql.Time toTime(java.lang.Object value)
throws AxionException
DataTypetoTime in interface DataTypeAxionExceptionResultSet.getTime(int)public java.sql.Timestamp toTimestamp(java.lang.Object value)
throws AxionException
DataTypetoTimestamp in interface DataTypeAxionExceptionResultSet.getTimestamp(int)public java.sql.Clob toClob(java.lang.Object value)
throws AxionException
DataTypetoClob in interface DataTypeAxionExceptionResultSet.getClob(int)public java.sql.Blob toBlob(java.lang.Object value)
throws AxionException
DataTypetoBlob in interface DataTypeAxionExceptionResultSet.getBlob(int)