org.axiondb.types
Class AnyType

java.lang.Object
  extended by org.axiondb.types.BaseDataType
      extended by org.axiondb.types.AnyType
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator, DataType, DataTypeFactory

public class AnyType
extends BaseDataType

Generic implemention of DataType, for use by BindVariable.

Version:
$Revision: 1.12 $ $Date: 2005/05/02 22:29:40 $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.axiondb.DataType
DataType.BinaryRepresentation, DataType.ExactNumeric, DataType.NonFixedPrecision
 
Field Summary
static AnyType INSTANCE
           
 
Constructor Summary
AnyType()
           
 
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 getPreferredValueClassName()
          Returns the "normal" type returned by DataType.convert(java.lang.Object).
 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 DataType.successor(java.lang.Object)method is supported, false otherwise.
 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.
protected  java.lang.Number toNumber(java.lang.Object value)
           
 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.
 void write(java.lang.Object value, java.io.DataOutput out)
          Write an object of my type to the given DataOutput.
 
Methods inherited from class org.axiondb.types.BaseDataType
compare, getComparator, getLiteralPrefix, getLiteralSuffix, getNullableCode, getPrecision, getPrecisionRadix, getScale, getSearchableCode, isCaseSensitive, isCurrency, isUnsigned, toBigDecimal, toBigInteger, toURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

INSTANCE

public static final AnyType INSTANCE
Constructor Detail

AnyType

public AnyType()
Method Detail

makeNewInstance

public DataType makeNewInstance()
Description copied from interface: DataType
Creates a new instance of this DataType implementation.

Specified by:
makeNewInstance in interface DataType
Specified by:
makeNewInstance in interface DataTypeFactory
Specified by:
makeNewInstance in class BaseDataType
Returns:
new instance of this DataType implementation.

accepts

public boolean accepts(java.lang.Object value)
Description copied from interface: DataType
Return true if a field of my type can be assigned the given non- null value , false otherwise.

Specified by:
accepts in interface DataType
Specified by:
accepts in class BaseDataType
Parameters:
value - non- null value

convert

public java.lang.Object convert(java.lang.Object value)
Description copied from interface: DataType
Converts an acceptablevalue to one of the appropriate type.

Specified by:
convert in interface DataType
Specified by:
convert in class BaseDataType

read

public java.lang.Object read(java.io.DataInput in)
                      throws java.io.IOException
Description copied from interface: DataType
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.write(java.lang.Object, java.io.DataOutput).

Specified by:
read in interface DataType
Specified by:
read in class BaseDataType
Throws:
java.io.IOException

write

public void write(java.lang.Object value,
                  java.io.DataOutput out)
           throws java.io.IOException
Description copied from interface: DataType
Write an object of my type to the given DataOutput.

Specified by:
write in interface DataType
Specified by:
write in class BaseDataType
Parameters:
value - the value to write, which must be acceptableto this DataType
Throws:
java.io.IOException

getColumnDisplaySize

public int getColumnDisplaySize()
Description copied from interface: DataType
Value returned by ResultSetMetaData#getColumnDisplaySizefor this data type.

Specified by:
getColumnDisplaySize in interface DataType
Overrides:
getColumnDisplaySize in class BaseDataType
See Also:
ResultSetMetaData.getColumnDisplaySize(int)

getJdbcType

public int getJdbcType()
Description copied from interface: DataType
Returns the JDBC type codemost closely matching this type.

Specified by:
getJdbcType in interface DataType
Specified by:
getJdbcType in class BaseDataType

getPreferredValueClassName

public java.lang.String getPreferredValueClassName()
Description copied from interface: DataType
Returns the "normal" type returned by DataType.convert(java.lang.Object). Returns java.lang.Object if unknown.

Specified by:
getPreferredValueClassName in interface DataType
Overrides:
getPreferredValueClassName in class BaseDataType
See Also:
AxionResultSetMetaData.getColumnClassName(int)

supportsSuccessor

public boolean supportsSuccessor()
Description copied from interface: DataType
Returns true if the DataType.successor(java.lang.Object)method is supported, false otherwise.

Specified by:
supportsSuccessor in interface DataType
Overrides:
supportsSuccessor in class BaseDataType

successor

public java.lang.Object successor(java.lang.Object value)
                           throws java.lang.IllegalArgumentException
Description copied from interface: DataType
Returns the successor for the given value. For example, the successor of the integer 1 is 2.

Specified by:
successor in interface DataType
Overrides:
successor in class BaseDataType
Throws:
java.lang.IllegalArgumentException

toNumber

protected java.lang.Number toNumber(java.lang.Object value)
                             throws AxionException
Overrides:
toNumber in class BaseDataType
Throws:
AxionException

toBoolean

public boolean toBoolean(java.lang.Object value)
                  throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a boolean, or throw a SQLException.

Specified by:
toBoolean in interface DataType
Overrides:
toBoolean in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getBoolean(int)

toByte

public byte toByte(java.lang.Object value)
            throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a byte, or throw a SQLException.

Specified by:
toByte in interface DataType
Overrides:
toByte in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getByte(int)

toByteArray

public byte[] toByteArray(java.lang.Object value)
                   throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a byte[], or throw a AxionException.

Specified by:
toByteArray in interface DataType
Overrides:
toByteArray in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getBytes(int)

toDouble

public double toDouble(java.lang.Object value)
                throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a double, or throw a AxionException.

Specified by:
toDouble in interface DataType
Overrides:
toDouble in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getDouble(int)

toFloat

public float toFloat(java.lang.Object value)
              throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a float, or throw a AxionException.

Specified by:
toFloat in interface DataType
Overrides:
toFloat in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getFloat(int)

toInt

public int toInt(java.lang.Object value)
          throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a int, or throw a AxionException.

Specified by:
toInt in interface DataType
Overrides:
toInt in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getInt(int)

toLong

public long toLong(java.lang.Object value)
            throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a long, or throw a AxionException.

Specified by:
toLong in interface DataType
Overrides:
toLong in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getLong(int)

toShort

public short toShort(java.lang.Object value)
              throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a short, or throw a AxionException.

Specified by:
toShort in interface DataType
Overrides:
toShort in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getShort(int)

toString

public java.lang.String toString(java.lang.Object value)
                          throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a String, or throw a AxionException.

Specified by:
toString in interface DataType
Overrides:
toString in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getString(int)

toDate

public java.sql.Date toDate(java.lang.Object value)
                     throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a Date, or throw a SQLException.

Specified by:
toDate in interface DataType
Overrides:
toDate in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getDate(int)

toTime

public java.sql.Time toTime(java.lang.Object value)
                     throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a Time, or throw a AxionException.

Specified by:
toTime in interface DataType
Overrides:
toTime in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getTime(int)

toTimestamp

public java.sql.Timestamp toTimestamp(java.lang.Object value)
                               throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a Timestamp, or throw a AxionException.

Specified by:
toTimestamp in interface DataType
Overrides:
toTimestamp in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getTimestamp(int)

toClob

public java.sql.Clob toClob(java.lang.Object value)
                     throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a Clob, or throw a AxionException.

Specified by:
toClob in interface DataType
Overrides:
toClob in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getClob(int)

toBlob

public java.sql.Blob toBlob(java.lang.Object value)
                     throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a Blob, or throw a AxionException.

Specified by:
toBlob in interface DataType
Overrides:
toBlob in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getBlob(int)