org.axiondb
Interface DataType

All Superinterfaces:
Comparator, Serializable
All Known Implementing Classes:
BaseDataType

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 convertingObjectsto this type, and for readingvalues from and writingvalues to a stream.

Version:
$Revision: 1.13 $ $Date: 2004/08/27 03:21:20 $

Method Summary
 boolean accepts(Object value)
          Return true if a field of my type can be assigned the given non- null value , false otherwise.
 Object convert(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.
 String getLiteralPrefix()
          Prefix used to quote a literal to delimit value for this type when in SQL syntax or result display
 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.
 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
 Object read(DataInput in)
          Instantiate an object of my type from the given DataInput.
 Object successor(Object value)
          Returns the successor for the given value.
 boolean supportsSuccessor()
          Returns true if the successor(java.lang.Object)method is supported, false otherwise.
 BigDecimal toBigDecimal(Object value)
          Convert the given non- null value to a BigDecimal, or throw a AxionException.
 BigInteger toBigInteger(Object value)
          Convert the given non- null value to a BigInteger, or throw a AxionException.
 Blob toBlob(Object value)
          Convert the given non- null value to a Blob, or throw a AxionException.
 boolean toBoolean(Object value)
          Convert the given non- null value to a boolean, or throw a SQLException.
 byte toByte(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.
 Clob toClob(Object value)
          Convert the given non- null value to a Clob, or throw a AxionException.
 Date toDate(Object value)
          Convert the given non- null value to a Date, or throw a SQLException.
 double toDouble(Object value)
          Convert the given non- null value to a double, or throw a AxionException.
 float toFloat(Object value)
          Convert the given non- null value to a float, or throw a AxionException.
 int toInt(Object value)
          Convert the given non- null value to a int, or throw a AxionException.
 long toLong(Object value)
          Convert the given non- null value to a long, or throw a AxionException.
 short toShort(Object value)
          Convert the given non- null value to a short, or throw a AxionException.
 String toString(Object value)
          Convert the given non- null value to a String, or throw a AxionException.
 Time toTime(Object value)
          Convert the given non- null value to a Time, or throw a AxionException.
 Timestamp toTimestamp(Object value)
          Convert the given non- null value to a Timestamp, or throw a AxionException.
 URL toURL(Object value)
          Convert the given non- null value to a URL, or throw a AxionException.
 void write(Object value, DataOutput out)
          Write an object of my type to the given DataOutput.
 
Methods inherited from interface java.util.Comparator
compare, equals
 

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.


getColumnDisplaySize

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

See Also:
ResultSetMetaData.getColumnDisplaySize(int)

getJdbcType

public int getJdbcType()
Returns the JDBC 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:
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:
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:
DatabaseMetaData.getTypeInfo()

getPrecision

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

See Also:
ResultSetMetaData.getPrecision(int)

getPreferredValueClassName

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

See Also:
ResultSetMetaData.getColumnClassName(int)

getScale

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

See Also:
ResultSetMetaData.getScale(int)

getSearchableCode

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

See Also:
DatabaseMetaData.getTypeInfo()

isCaseSensitive

public 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

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

isUnsigned

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

See Also:
DatabaseMetaData.getTypeInfo()

read

public Object read(DataInput in)
            throws 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:
IOException

successor

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

Throws:
UnsupportedOperationException

supportsSuccessor

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


toBigDecimal

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

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

toBigInteger

public BigInteger toBigInteger(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

public Blob toBlob(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

public boolean toBoolean(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

public byte toByte(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

public byte[] toByteArray(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

public Clob toClob(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

public Date toDate(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

public double toDouble(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

public float toFloat(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

public int toInt(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

public long toLong(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

public short toShort(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

public String toString(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

public Time toTime(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

public Timestamp toTimestamp(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

public URL toURL(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

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

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