org.axiondb

Interface DataType

public interface DataType extends Comparator, Serializable

The type of a field (column) that can be stored in a Table.

Responsible for testingthat a value is assignable to fields of this type, for convertingObject Objectsto this type, and for readingvalues from and writingvalues to a stream.

Version: $Revision: 1.14 $ $Date: 2005/05/02 22:17:47 $

Author: Rodney Waldhoff Rob Oxspring Chuck Burdick

Nested Class Summary
static interfaceDataType.BinaryRepresentation
Extension of DataType to indicate that the implementing class stores binary values, and as such returns precision as the number of bits used to represent a given value.
static interfaceDataType.ExactNumeric
Extension of NonFixedPrecision to indicate that the scale of the implementing class is not fixed by the implementation, but rather can be declared by the user.
static interfaceDataType.NonFixedPrecision
Extension of DataType to indicate that the precision of the implementing class is not fixed by the implementation, but rather can be declared by the user.
Method Summary
booleanaccepts(Object value)
Return true if a field of my type can be assigned the given non- null value , false otherwise.
Objectconvert(Object value)
Converts an acceptablevalue to one of the appropriate type.
intgetColumnDisplaySize()
Value returned by ResultSetMetaData#getColumnDisplaySizefor this data type.
intgetJdbcType()
Returns the JDBC java.sql.Types type codemost closely matching this type.
StringgetLiteralPrefix()
Prefix used to quote a literal to delimit value for this type when in SQL syntax or result display
StringgetLiteralSuffix()
Suffix used to quote a literal to delimit value for this type when in SQL syntax or result display
intgetNullableCode()
Code indicating that type does not accept, does accept, or does not disclose acceptance of null values
intgetPrecision()
Value returned by ResultSetMetaData#getPrecisionfor this data type.
intgetPrecisionRadix()
Indicates radix used to compute maximum number of significant digits for this datatype, as returned by DataType.
StringgetPreferredValueClassName()
Returns the "normal" type returned by DataType.
intgetScale()
Value returned by ResultSetMetaData#getScalefor this data type.
shortgetSearchableCode()
Code indicating how much WHERE ...
booleanisCaseSensitive()
For character and string-related types, indicates whether type acknowledges case when storing and retrieving values
booleanisCurrency()
booleanisUnsigned()
For numeric types, indicates whether type stores only non-negative (>= 0) values
DataTypemakeNewInstance()
Creates a new instance of this DataType implementation.
Objectread(DataInput in)
Instantiate an object of my type from the given DataInput.
Objectsuccessor(Object value)
Returns the successor for the given value.
booleansupportsSuccessor()
Returns true if the DataTypemethod is supported, false otherwise.
BigDecimaltoBigDecimal(Object value)
Convert the given non- null value to a BigDecimal, or throw a AxionException.
BigIntegertoBigInteger(Object value)
Convert the given non- null value to a BigInteger, or throw a AxionException.
BlobtoBlob(Object value)
Convert the given non- null value to a Blob, or throw a AxionException.
booleantoBoolean(Object value)
Convert the given non- null value to a boolean, or throw a SQLException.
bytetoByte(Object value)
Convert the given non- null value to a byte, or throw a SQLException.
byte[]toByteArray(Object value)
Convert the given non- null value to a byte[], or throw a AxionException.
ClobtoClob(Object value)
Convert the given non- null value to a Clob, or throw a AxionException.
DatetoDate(Object value)
Convert the given non- null value to a java.sql.Date, or throw a SQLException.
doubletoDouble(Object value)
Convert the given non- null value to a double, or throw a AxionException.
floattoFloat(Object value)
Convert the given non- null value to a float, or throw a AxionException.
inttoInt(Object value)
Convert the given non- null value to a int, or throw a AxionException.
longtoLong(Object value)
Convert the given non- null value to a long, or throw a AxionException.
shorttoShort(Object value)
Convert the given non- null value to a short, or throw a AxionException.
StringtoString(Object value)
Convert the given non- null value to a String, or throw a AxionException.
TimetoTime(Object value)
Convert the given non- null value to a Time, or throw a AxionException.
TimestamptoTimestamp(Object value)
Convert the given non- null value to a Timestamp, or throw a AxionException.
URLtoURL(Object value)
Convert the given non- null value to a URL, or throw a AxionException.
voidwrite(Object value, DataOutput out)
Write an object of my type to the given DataOutput.

Method Detail

accepts

public boolean accepts(Object value)
Return true if a field of my type can be assigned the given non- null value , false otherwise.

Parameters: value non- null value

convert

public Object convert(Object value)
Converts an acceptablevalue to one of the appropriate type.

Throws: AxionException

getColumnDisplaySize

public int getColumnDisplaySize()
Value returned by ResultSetMetaData#getColumnDisplaySizefor this data type.

See Also: java.sql.ResultSetMetaData#getColumnDisplaySize

getJdbcType

public int getJdbcType()
Returns the JDBC java.sql.Types type codemost closely matching this type.

getLiteralPrefix

public String getLiteralPrefix()
Prefix used to quote a literal to delimit value for this type when in SQL syntax or result display

See Also: java.sql.DatabaseMetaData#getTypeInfo

getLiteralSuffix

public String getLiteralSuffix()
Suffix used to quote a literal to delimit value for this type when in SQL syntax or result display

See Also: java.sql.DatabaseMetaData#getTypeInfo

getNullableCode

public int getNullableCode()
Code indicating that type does not accept, does accept, or does not disclose acceptance of null values

See Also: java.sql.DatabaseMetaData#getTypeInfo

getPrecision

public int getPrecision()
Value returned by ResultSetMetaData#getPrecisionfor this data type.

See Also: java.sql.ResultSetMetaData#getPrecision

getPrecisionRadix

public int getPrecisionRadix()
Indicates radix used to compute maximum number of significant digits for this datatype, as returned by DataType.

Returns: radix used to compute value of DataType, typically 2 or 10.

getPreferredValueClassName

public String getPreferredValueClassName()
Returns the "normal" type returned by DataType. Returns java.lang.Object if unknown.

See Also: java.sql.ResultSetMetaData#getColumnClassName

getScale

public int getScale()
Value returned by ResultSetMetaData#getScalefor this data type.

See Also: java.sql.ResultSetMetaData#getScale

getSearchableCode

public short getSearchableCode()
Code indicating how much WHERE ... LIKE support is available across a column of this type

See Also: java.sql.DatabaseMetaData#getTypeInfo

isCaseSensitive

public boolean isCaseSensitive()
For character and string-related types, indicates whether type acknowledges case when storing and retrieving values

See Also: java.sql.DatabaseMetaData#getTypeInfo java.sql.ResultSetMetaData#isCaseSensitive

isCurrency

public boolean isCurrency()

See Also: java.sql.ResultSetMetaData#isCurrency

isUnsigned

public boolean isUnsigned()
For numeric types, indicates whether type stores only non-negative (>= 0) values

See Also: java.sql.DatabaseMetaData#getTypeInfo

makeNewInstance

public DataType makeNewInstance()
Creates a new instance of this DataType implementation.

Returns: new instance of this DataType implementation.

read

public Object read(DataInput in)
Instantiate an object of my type from the given DataInput. The next sequence of bytes to be read from the DataInput will have been written by DataType.

successor

public Object successor(Object value)
Returns the successor for the given value. For example, the successor of the integer 1 is 2.

supportsSuccessor

public boolean supportsSuccessor()
Returns true if the DataTypemethod is supported, false otherwise.

toBigDecimal

public BigDecimal toBigDecimal(Object value)
Convert the given non- null value to a BigDecimal, or throw a AxionException.

See Also: java.sql.ResultSet#getBigDecimal

toBigInteger

public BigInteger toBigInteger(Object value)
Convert the given non- null value to a BigInteger, or throw a AxionException.

See Also: java.sql.ResultSet#getBigInteger

toBlob

public Blob toBlob(Object value)
Convert the given non- null value to a Blob, or throw a AxionException.

See Also: java.sql.ResultSet#getBlob

toBoolean

public boolean toBoolean(Object value)
Convert the given non- null value to a boolean, or throw a SQLException.

See Also: java.sql.ResultSet#getBoolean

toByte

public byte toByte(Object value)
Convert the given non- null value to a byte, or throw a SQLException.

See Also: java.sql.ResultSet#getByte

toByteArray

public byte[] toByteArray(Object value)
Convert the given non- null value to a byte[], or throw a AxionException.

See Also: java.sql.ResultSet#getBytes

toClob

public Clob toClob(Object value)
Convert the given non- null value to a Clob, or throw a AxionException.

See Also: java.sql.ResultSet#getClob

toDate

public Date toDate(Object value)
Convert the given non- null value to a java.sql.Date, or throw a SQLException.

See Also: java.sql.ResultSet#getDate

toDouble

public double toDouble(Object value)
Convert the given non- null value to a double, or throw a AxionException.

See Also: java.sql.ResultSet#getDouble

toFloat

public float toFloat(Object value)
Convert the given non- null value to a float, or throw a AxionException.

See Also: java.sql.ResultSet#getFloat

toInt

public int toInt(Object value)
Convert the given non- null value to a int, or throw a AxionException.

See Also: java.sql.ResultSet#getInt

toLong

public long toLong(Object value)
Convert the given non- null value to a long, or throw a AxionException.

See Also: java.sql.ResultSet#getLong

toShort

public short toShort(Object value)
Convert the given non- null value to a short, or throw a AxionException.

See Also: java.sql.ResultSet#getShort

toString

public String toString(Object value)
Convert the given non- null value to a String, or throw a AxionException.

See Also: java.sql.ResultSet#getString

toTime

public Time toTime(Object value)
Convert the given non- null value to a Time, or throw a AxionException.

See Also: java.sql.ResultSet#getTime

toTimestamp

public Timestamp toTimestamp(Object value)
Convert the given non- null value to a Timestamp, or throw a AxionException.

See Also: java.sql.ResultSet#getTimestamp

toURL

public URL toURL(Object value)
Convert the given non- null value to a URL, or throw a AxionException.

See Also: java.sql.ResultSet#getURL

write

public void write(Object value, DataOutput out)
Write an object of my type to the given DataOutput.

Parameters: value the value to write, which must be acceptableto this DataType