org.axiondb.types
Class BooleanType

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

public class BooleanType
extends BaseDataType

A DataTyperepresenting a Boolean value.

Version:
$Revision: 1.15 $ $Date: 2005/10/13 02:25:32 $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.axiondb.DataType
DataType.BinaryRepresentation, DataType.ExactNumeric, DataType.NonFixedPrecision
 
Constructor Summary
BooleanType()
           
 
Method Summary
 boolean accepts(java.lang.Object value)
          Returns true iff value is null, or a Boolean.
 java.lang.Object convert(java.lang.Object value)
          Returns a Boolean converted from the given value , or throws IllegalArgumentExceptionif the given value isn't acceptable.
 int getColumnDisplaySize()
          Value returned by ResultSetMetaData#getColumnDisplaySizefor this data type.
 java.util.Comparator getComparator()
          This base implementation simply returns a ComparableComparator.
 int getJdbcType()
          Returns the JDBC type codemost closely matching this type.
 int getPrecision()
          Value returned by ResultSetMetaData#getPrecisionfor this data 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.
 boolean toBoolean(java.lang.Object value)
          Convert the given non- null value to a boolean, or throw a SQLException.
 java.lang.String toString()
          Returns "boolean"
 void write(java.lang.Object value, java.io.DataOutput out)
          Writes the given value to the given DataOutput.
 
Methods inherited from class org.axiondb.types.BaseDataType
compare, getLiteralPrefix, getLiteralSuffix, getNullableCode, getPrecisionRadix, getScale, getSearchableCode, isCaseSensitive, isCurrency, isUnsigned, successor, supportsSuccessor, toBigDecimal, toBigInteger, toBlob, toByte, toByteArray, toClob, toDate, toDouble, toFloat, toInt, toLong, toNumber, toShort, toString, toTime, toTimestamp, toURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

BooleanType

public BooleanType()
Method Detail

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
Returns:
Types.BOOLEAN

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)

getPrecision

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

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

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)

getComparator

public java.util.Comparator getComparator()
Description copied from class: BaseDataType
This base implementation simply returns a ComparableComparator.

Overrides:
getComparator in class BaseDataType

toString

public java.lang.String toString()
Returns "boolean"

Overrides:
toString in class java.lang.Object
Returns:
"boolean"

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)

accepts

public boolean accepts(java.lang.Object value)
Returns true iff value is null, or a Boolean.

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)
                         throws java.lang.IllegalArgumentException
Returns a Boolean converted from the given value , or throws IllegalArgumentExceptionif the given value isn't acceptable.

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

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
See Also:
write(java.lang.Object, java.io.DataOutput)

write

public void write(java.lang.Object value,
                  java.io.DataOutput out)
           throws java.io.IOException
Writes the given value to the given DataOutput. Null values are written as (byte)-1, false values are written as (byte)0, true values are written as (byte)1.

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

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.