org.axiondb
Interface DataType

All Superinterfaces:
java.util.Comparator, java.io.Serializable
All Known Subinterfaces:
DataType.BinaryRepresentation, DataType.ExactNumeric, DataType.NonFixedPrecision
All Known Implementing Classes:
AnyType, BaseDataType, BaseNumberDataType, BigDecimalType, BigIntType, BLOBType, BooleanType, ByteType, CharacterType, CharacterVaryingType, CLOBType, CompressedLOBType, DateType, DoubleType, FloatType, IntegerType, LOBType, ObjectType, ShortType, StringType, TimestampType, TimeType, UnsignedByteType, UnsignedIntegerType, UnsignedShortType, VarBinaryType

public interface DataType
extends java.util.Comparator, java.io.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 convertingObjectsto this type, and for readingvalues from and writingvalues to a stream.

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

Nested Class Summary
static interface DataType.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 interface DataType.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 interface DataType.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
 boolean accepts(java.lang.Object value)
          Return true if a field of my type can be assigned the given non- null value , false otherwise.
 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.
 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 getPrecision().
 java.lang.String getPreferredValueClassName()
          Returns the "normal" type returned by 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
 DataType makeNewInstance()
          Creates a new instance of this DataType implementation.
 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 successor(java.lang.Object)method is supported, false otherwise.
 java.math.BigDecimal toBigDecimal(java.lang.Object value)
          Convert the given non- null value to a BigDecimal, or throw a AxionException.
 java.math.BigInteger toBigInteger(java.lang.Object value)
          Convert the given non- null value to a BigInteger, or throw a AxionException.
 java.sql.Blob toBlob(java.lang.Object value)
          Convert the given non- null value to a Blob, or throw a AxionException.
 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)
          Convert the given non- null value to a byte[], or throw a AxionException.
 java.sql.Clob toClob(java.lang.Object value)
          Convert the given non- null value to a Clob, or throw a AxionException.
 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)
          Convert the given non- null value to a double, or throw a AxionException.
 float toFloat(java.lang.Object value)
          Convert the given non- null value to a float, or throw a AxionException.
 int toInt(java.lang.Object value)
          Convert the given non- null value to a int, or throw a AxionException.
 long toLong(java.lang.Object value)
          Convert the given non- null value to a long, or throw a AxionException.
 short toShort(java.lang.Object value)
          Convert the given non- null value to a short, or throw a AxionException.
 java.lang.String toString(java.lang.Object value)
          Convert the given non- null value to a String, or throw a AxionException.
 java.sql.Time toTime(java.lang.Object value)
          Convert the given non- null value to a Time, or throw a AxionException.
 java.sql.Timestamp toTimestamp(java.lang.Object value)
          Convert the given non- null value to a Timestamp, or throw a AxionException.
 java.net.URL toURL(java.lang.Object value)
          Convert the given non- null value to a URL, or throw a AxionException.
 void write(java.lang.Object value, java.io.DataOutput out)
          Write an object of my type to the given DataOutput.
 
Methods inherited from interface java.util.Comparator
compare, equals
 

Method Detail

accepts

boolean accepts(java.lang.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

java.lang.Object convert(java.lang.Object value)
                         throws AxionException
Converts an acceptablevalue to one of the appropriate type.

Throws:
AxionException

getColumnDisplaySize

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

See Also:
ResultSetMetaData.getColumnDisplaySize(int)

getJdbcType

int getJdbcType()
Returns the JDBC type codemost closely matching this type.


getLiteralPrefix

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

See Also:
DatabaseMetaData.getTypeInfo()

getLiteralSuffix

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

See Also:
DatabaseMetaData.getTypeInfo()

getNullableCode

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

See Also:
DatabaseMetaData.getTypeInfo()

getPrecision

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

See Also:
ResultSetMetaData.getPrecision(int)

getPrecisionRadix

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

Returns:
radix used to compute value of getPrecision(), typically 2 or 10.

getPreferredValueClassName

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

See Also:
ResultSetMetaData.getColumnClassName(int)

getScale

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

See Also:
ResultSetMetaData.getScale(int)

getSearchableCode

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

See Also:
DatabaseMetaData.getTypeInfo()

isCaseSensitive

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

See Also:
DatabaseMetaData.getTypeInfo(), ResultSetMetaData.isCaseSensitive(int)

isCurrency

boolean isCurrency()
See Also:
ResultSetMetaData.isCurrency(int)

isUnsigned

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

See Also:
DatabaseMetaData.getTypeInfo()

read

java.lang.Object read(java.io.DataInput in)
                      throws java.io.IOException
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 write(java.lang.Object, java.io.DataOutput).

Throws:
java.io.IOException

successor

java.lang.Object successor(java.lang.Object value)
                           throws java.lang.UnsupportedOperationException
Returns the successor for the given value. For example, the successor of the integer 1 is 2.

Throws:
java.lang.UnsupportedOperationException

supportsSuccessor

boolean supportsSuccessor()
Returns true if the successor(java.lang.Object)method is supported, false otherwise.


toBigDecimal

java.math.BigDecimal toBigDecimal(java.lang.Object value)
                                  throws AxionException
Convert the given non- null value to a BigDecimal, or throw a AxionException.

Throws:
AxionException
See Also:
ResultSet.getBigDecimal(int, int)

toBigInteger

java.math.BigInteger toBigInteger(java.lang.Object value)
                                  throws AxionException
Convert the given non- null value to a BigInteger, or throw a AxionException.

Throws:
AxionException
See Also:
java.sql.ResultSet#getBigInteger

toBlob

java.sql.Blob toBlob(java.lang.Object value)
                     throws AxionException
Convert the given non- null value to a Blob, or throw a AxionException.

Throws:
AxionException
See Also:
ResultSet.getBlob(int)

toBoolean

boolean toBoolean(java.lang.Object value)
                  throws AxionException
Convert the given non- null value to a boolean, or throw a SQLException.

Throws:
AxionException
See Also:
ResultSet.getBoolean(int)

toByte

byte toByte(java.lang.Object value)
            throws AxionException
Convert the given non- null value to a byte, or throw a SQLException.

Throws:
AxionException
See Also:
ResultSet.getByte(int)

toByteArray

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

Throws:
AxionException
See Also:
ResultSet.getBytes(int)

toClob

java.sql.Clob toClob(java.lang.Object value)
                     throws AxionException
Convert the given non- null value to a Clob, or throw a AxionException.

Throws:
AxionException
See Also:
ResultSet.getClob(int)

toDate

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

Throws:
AxionException
See Also:
ResultSet.getDate(int)

toDouble

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

Throws:
AxionException
See Also:
ResultSet.getDouble(int)

toFloat

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

Throws:
AxionException
See Also:
ResultSet.getFloat(int)

toInt

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

Throws:
AxionException
See Also:
ResultSet.getInt(int)

toLong

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

Throws:
AxionException
See Also:
ResultSet.getLong(int)

toShort

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

Throws:
AxionException
See Also:
ResultSet.getShort(int)

toString

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

Throws:
AxionException
See Also:
ResultSet.getString(int)

toTime

java.sql.Time toTime(java.lang.Object value)
                     throws AxionException
Convert the given non- null value to a Time, or throw a AxionException.

Throws:
AxionException
See Also:
ResultSet.getTime(int)

toTimestamp

java.sql.Timestamp toTimestamp(java.lang.Object value)
                               throws AxionException
Convert the given non- null value to a Timestamp, or throw a AxionException.

Throws:
AxionException
See Also:
ResultSet.getTimestamp(int)

toURL

java.net.URL toURL(java.lang.Object value)
                   throws AxionException
Convert the given non- null value to a URL, or throw a AxionException.

Throws:
AxionException
See Also:
ResultSet.getURL(int)

write

void write(java.lang.Object value,
           java.io.DataOutput out)
           throws java.io.IOException
Write an object of my type to the given DataOutput.

Parameters:
value - the value to write, which must be acceptableto this DataType
Throws:
java.io.IOException

makeNewInstance

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

Returns:
new instance of this DataType implementation.