org.axiondb.types
Class BaseNumberDataType

java.lang.Object
  extended byorg.axiondb.types.BaseDataType
      extended byorg.axiondb.types.BaseNumberDataType
All Implemented Interfaces:
Comparator, DataType, DataTypeFactory, Serializable
Direct Known Subclasses:
BigDecimalType, ByteType, FloatType, IntegerType, LongType, ShortType, UnsignedByteType, UnsignedIntegerType, UnsignedShortType

public abstract class BaseNumberDataType
extends BaseDataType

An abstract base DataType for Number types.

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

Constructor Summary
BaseNumberDataType()
           
 
Method Summary
 boolean accepts(Object value)
          Returns true iff value is String that can be converted without exception, null, or a Number.
 Object convert(Object value)
          Returns value if value is null and throws IllegalArgumentException otherwise.
 boolean supportsSuccessor()
          This base implementation returns true.
protected  Number toNumber(Object value)
           
 
Methods inherited from class org.axiondb.types.BaseDataType
compare, getColumnDisplaySize, getComparator, getJdbcType, getLiteralPrefix, getLiteralSuffix, getNullableCode, getPrecision, getPreferredValueClassName, getScale, getSearchableCode, isCaseSensitive, isCurrency, isUnsigned, makeNewInstance, read, successor, toBigDecimal, toBigInteger, toBlob, toBoolean, toByte, toByteArray, toClob, toDate, toDouble, toFloat, toInt, toLong, toShort, toString, toTime, toTimestamp, toURL, write
 
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
 

Constructor Detail

BaseNumberDataType

public BaseNumberDataType()
Method Detail

accepts

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

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

convert

public Object convert(Object value)
               throws IllegalArgumentException
Returns value if value is null and throws IllegalArgumentException otherwise. Subclasses should override this method and call super.convert(value) as their last case.

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

supportsSuccessor

public boolean supportsSuccessor()
This base implementation returns true.

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

toNumber

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