org.axiondb.types
Class BigDecimalType

java.lang.Object
  extended by org.axiondb.types.BaseDataType
      extended by org.axiondb.types.BaseNumberDataType
          extended by org.axiondb.types.BigDecimalType
All Implemented Interfaces:
Serializable, Comparator, DataType, DataTypeFactory

public class BigDecimalType
extends BaseNumberDataType

A DataType representing an number value.

Version:
$Revision: 1.9 $ $Date: 2004/09/09 23:47:42 $
See Also:
Serialized Form

Constructor Summary
BigDecimalType()
           
BigDecimalType(int scale)
           
 
Method Summary
 boolean accepts(Object value)
          Returns true iff value is String that can be converted without exception, null, or a Number.
 int compare(Object a, Object b)
           
 Object convert(Object value)
          Returns a Float converted from the given value, or throws IllegalArgumentException if the given value isn't acceptable.
protected  Comparator getComparator()
          This base implementation simply returns a ComparableComparator.
 int getJdbcType()
          Returns the JDBC type codemost closely matching this type.
 String getPreferredValueClassName()
          Returns the "normal" type returned by DataType.convert(java.lang.Object).
 int getScale()
          Value returned by ResultSetMetaData#getScalefor this data type.
 DataType makeNewInstance()
           
 DataType makeNewInstance(int scale)
           
 Object read(DataInput in)
          Instantiate an object of my type from the given DataInput.
 boolean supportsSuccessor()
          false
 String toString()
          Returns "BigDecimal"
 void write(Object value, DataOutput out)
          Write an object of my type to the given DataOutput.
 
Methods inherited from class org.axiondb.types.BaseNumberDataType
toNumber
 
Methods inherited from class org.axiondb.types.BaseDataType
getColumnDisplaySize, getLiteralPrefix, getLiteralSuffix, getNullableCode, getPrecision, getSearchableCode, isCaseSensitive, isCurrency, isUnsigned, successor, toBigDecimal, toBigInteger, toBlob, toBoolean, toByte, toByteArray, toClob, toDate, toDouble, toFloat, toInt, toLong, 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

BigDecimalType

public BigDecimalType()

BigDecimalType

public BigDecimalType(int scale)
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

getPreferredValueClassName

public 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)

getScale

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

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

toString

public String toString()
Returns "BigDecimal"

Overrides:
toString in class Object
Returns:
"BigDecimal"

accepts

public boolean accepts(Object value)
Description copied from class: BaseNumberDataType
Returns true iff value is String that can be converted without exception, null, or a Number.

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

convert

public Object convert(Object value)
               throws IllegalArgumentException
Returns a Float converted from the given value, or throws IllegalArgumentException if the given value isn't acceptable.

Specified by:
convert in interface DataType
Overrides:
convert in class BaseNumberDataType
Throws:
IllegalArgumentException

read

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

supportsSuccessor

public boolean supportsSuccessor()
false

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

write

public void write(Object value,
                  DataOutput out)
           throws 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:
IOException

makeNewInstance

public DataType makeNewInstance()
Specified by:
makeNewInstance in interface DataTypeFactory
Specified by:
makeNewInstance in class BaseDataType

makeNewInstance

public DataType makeNewInstance(int scale)

compare

public int compare(Object a,
                   Object b)
Specified by:
compare in interface Comparator
Overrides:
compare in class BaseDataType

getComparator

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

Overrides:
getComparator in class BaseDataType