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
acceptable value to one of the appropriate type. |
int |
getColumnDisplaySize()
Value returned by
ResultSetMetaData#getColumnDisplaySize for this data
type. |
protected java.util.Comparator |
getComparator()
This base implementation simply returns a
ComparableComparator . |
abstract int |
getJdbcType()
Returns the JDBC
type code most 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#getPrecision for 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#getScale for 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()
DataType
makeNewInstance
in interface DataType
makeNewInstance
in interface DataTypeFactory
public abstract boolean accepts(java.lang.Object value)
DataType
true
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
DataType
acceptable
value to one of the appropriate type.convert
in interface DataType
AxionException
public abstract java.lang.Object read(java.io.DataInput in) throws java.io.IOException
DataType
DataInput
. 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
DataType
DataOutput
.write
in interface DataType
value
- the value to write, which must be acceptable
to this
DataType
java.io.IOException
public abstract int getJdbcType()
DataType
type code
most closely matching this type.getJdbcType
in interface DataType
public java.lang.String getPreferredValueClassName()
DataType
DataType.convert(java.lang.Object)
. Returns
java.lang.Object if unknown.getPreferredValueClassName
in interface DataType
AxionResultSetMetaData.getColumnClassName(int)
public int compare(java.lang.Object a, java.lang.Object b)
compare
in interface java.util.Comparator
protected java.util.Comparator getComparator()
ComparableComparator
.public int getColumnDisplaySize()
DataType
ResultSetMetaData#getColumnDisplaySize
for this data
type.getColumnDisplaySize
in interface DataType
ResultSetMetaData.getColumnDisplaySize(int)
public int getPrecision()
DataType
ResultSetMetaData#getPrecision
for this data type.getPrecision
in interface DataType
ResultSetMetaData.getPrecision(int)
public int getScale()
DataType
ResultSetMetaData#getScale
for this data type.public boolean isCaseSensitive()
DataType
isCaseSensitive
in interface DataType
DatabaseMetaData.getTypeInfo()
,
ResultSetMetaData.isCaseSensitive(int)
public boolean isCurrency()
isCurrency
in interface DataType
ResultSetMetaData.isCurrency(int)
public java.lang.String getLiteralPrefix()
DataType
getLiteralPrefix
in interface DataType
DatabaseMetaData.getTypeInfo()
public java.lang.String getLiteralSuffix()
DataType
getLiteralSuffix
in interface DataType
DatabaseMetaData.getTypeInfo()
public int getNullableCode()
DataType
null
valuesgetNullableCode
in interface DataType
DatabaseMetaData.getTypeInfo()
public short getSearchableCode()
DataType
WHERE ... LIKE
support is available across
a column of this typegetSearchableCode
in interface DataType
DatabaseMetaData.getTypeInfo()
public boolean isUnsigned()
DataType
isUnsigned
in interface DataType
DatabaseMetaData.getTypeInfo()
public boolean supportsSuccessor()
DataType
true
if the DataType.successor(java.lang.Object)
method is supported, false
otherwise.supportsSuccessor
in interface DataType
public java.lang.Object successor(java.lang.Object value) throws java.lang.IllegalArgumentException
DataType
public int getPrecisionRadix()
DataType
DataType.getPrecision()
.getPrecisionRadix
in interface DataType
DataType.getPrecision()
, typically 2 or 10.protected java.lang.Number toNumber(java.lang.Object value) throws AxionException
AxionException
public java.math.BigDecimal toBigDecimal(java.lang.Object value) throws AxionException
DataType
toBigDecimal
in interface DataType
AxionException
ResultSet.getBigDecimal(int, int)
public java.math.BigInteger toBigInteger(java.lang.Object value) throws AxionException
DataType
toBigInteger
in interface DataType
AxionException
java.sql.ResultSet#getBigInteger
public boolean toBoolean(java.lang.Object value) throws AxionException
DataType
null
value to a boolean
,
or throw a SQLException
.toBoolean
in interface DataType
AxionException
ResultSet.getBoolean(int)
public byte toByte(java.lang.Object value) throws AxionException
DataType
null
value to a byte
,
or throw a SQLException
.toByte
in interface DataType
AxionException
ResultSet.getByte(int)
public byte[] toByteArray(java.lang.Object value) throws AxionException
DataType
toByteArray
in interface DataType
AxionException
ResultSet.getBytes(int)
public java.sql.Date toDate(java.lang.Object value) throws AxionException
DataType
null
value to a Date
,
or throw a SQLException
.toDate
in interface DataType
AxionException
ResultSet.getDate(int)
public double toDouble(java.lang.Object value) throws AxionException
DataType
toDouble
in interface DataType
AxionException
ResultSet.getDouble(int)
public float toFloat(java.lang.Object value) throws AxionException
DataType
toFloat
in interface DataType
AxionException
ResultSet.getFloat(int)
public int toInt(java.lang.Object value) throws AxionException
DataType
toInt
in interface DataType
AxionException
ResultSet.getInt(int)
public long toLong(java.lang.Object value) throws AxionException
DataType
toLong
in interface DataType
AxionException
ResultSet.getLong(int)
public short toShort(java.lang.Object value) throws AxionException
DataType
toShort
in interface DataType
AxionException
ResultSet.getShort(int)
public java.lang.String toString(java.lang.Object value) throws AxionException
DataType
toString
in interface DataType
AxionException
ResultSet.getString(int)
public java.net.URL toURL(java.lang.Object value) throws AxionException
DataType
toURL
in interface DataType
AxionException
ResultSet.getURL(int)
public java.sql.Time toTime(java.lang.Object value) throws AxionException
DataType
toTime
in interface DataType
AxionException
ResultSet.getTime(int)
public java.sql.Timestamp toTimestamp(java.lang.Object value) throws AxionException
DataType
toTimestamp
in interface DataType
AxionException
ResultSet.getTimestamp(int)
public java.sql.Clob toClob(java.lang.Object value) throws AxionException
DataType
toClob
in interface DataType
AxionException
ResultSet.getClob(int)
public java.sql.Blob toBlob(java.lang.Object value) throws AxionException
DataType
toBlob
in interface DataType
AxionException
ResultSet.getBlob(int)