public class BigDecimalType extends BaseNumberDataType implements DataType.ExactNumeric
DataType
representing an number value.DataType.BinaryRepresentation, DataType.ExactNumeric, DataType.NonFixedPrecision
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PRECISION |
static int |
DEFAULT_SCALE |
static int |
MAX_PRECISION |
static int |
ROUNDING_RULE |
Constructor and Description |
---|
BigDecimalType() |
BigDecimalType(java.math.BigDecimal result) |
BigDecimalType(int scale) |
BigDecimalType(int precision,
int scale) |
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(java.lang.Object value)
|
int |
compare(java.lang.Object a,
java.lang.Object b) |
java.lang.Object |
convert(java.lang.Object value)
Returns a BigDecimal converted from the given value , or throws
IllegalArgumentException if the given value isn't
acceptable . |
int |
getColumnDisplaySize()
Value returned by
ResultSetMetaData#getColumnDisplaySize for this data
type. |
protected java.util.Comparator |
getComparator()
This base implementation simply returns a
ComparableComparator . |
int |
getJdbcType()
Returns the JDBC
type code most closely matching this type. |
int |
getPrecision()
Value returned by
ResultSetMetaData#getPrecision for this data type. |
java.lang.String |
getPreferredValueClassName()
Returns the "normal" type returned by
DataType.convert(java.lang.Object) . |
int |
getScale()
Value returned by
ResultSetMetaData#getScale for this data type. |
DataType |
makeNewInstance()
Creates a new instance of this DataType implementation.
|
DataType.ExactNumeric |
makeNewInstance(int newPrecision,
int newScale)
Creates a new instance of the implementing ExactNumeric type with the given
precision and scale.
|
java.lang.Object |
read(java.io.DataInput in)
Instantiate an object of my type from the given
DataInput . |
boolean |
requiresRounding(java.math.BigDecimal value) |
void |
setPrecision(int newPrecision)
Overrides the default precision with the given value.
|
void |
setScale(int newScale)
Overrides the default scale with the given value.
|
java.lang.Object |
successor(java.lang.Object value)
Returns the successor for the given value.
|
boolean |
supportsSuccessor()
false |
java.lang.String |
toString()
Returns
"BigDecimal" |
void |
write(java.lang.Object value,
java.io.DataOutput out)
Write an object of my type to the given
DataOutput . |
toNumber
getLiteralPrefix, getLiteralSuffix, getNullableCode, getPrecisionRadix, getSearchableCode, isCaseSensitive, isCurrency, isUnsigned, toBigDecimal, toBigInteger, toBlob, toBoolean, toByte, toByteArray, toClob, toDate, toDouble, toFloat, toInt, toLong, toShort, toString, toTime, toTimestamp, toURL
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getLiteralPrefix, getLiteralSuffix, getNullableCode, getPrecisionRadix, getSearchableCode, isCaseSensitive, isCurrency, isUnsigned, toBigDecimal, toBigInteger, toBlob, toBoolean, toByte, toByteArray, toClob, toDate, toDouble, toFloat, toInt, toLong, toShort, toString, toTime, toTimestamp, toURL
public static final int ROUNDING_RULE
public static final int DEFAULT_PRECISION
public static final int DEFAULT_SCALE
public static final int MAX_PRECISION
public BigDecimalType()
public BigDecimalType(int scale)
public BigDecimalType(int precision, int scale)
public BigDecimalType(java.math.BigDecimal result)
public int getColumnDisplaySize()
DataType
ResultSetMetaData#getColumnDisplaySize
for this data
type.getColumnDisplaySize
in interface DataType
getColumnDisplaySize
in class BaseDataType
ResultSetMetaData.getColumnDisplaySize(int)
public int getPrecision()
DataType
ResultSetMetaData#getPrecision
for this data type.getPrecision
in interface DataType
getPrecision
in class BaseDataType
ResultSetMetaData.getPrecision(int)
public int getJdbcType()
DataType
type code
most closely matching this type.getJdbcType
in interface DataType
getJdbcType
in class BaseDataType
public java.lang.String getPreferredValueClassName()
DataType
DataType.convert(java.lang.Object)
. Returns
java.lang.Object if unknown.getPreferredValueClassName
in interface DataType
getPreferredValueClassName
in class BaseDataType
AxionResultSetMetaData.getColumnClassName(int)
public int getScale()
DataType
ResultSetMetaData#getScale
for this data type.getScale
in interface DataType
getScale
in class BaseDataType
ResultSetMetaData.getScale(int)
public void setPrecision(int newPrecision)
DataType.NonFixedPrecision
setPrecision
in interface DataType.NonFixedPrecision
newPrecision
- new precision value. The appropriate value depends on the
precision radix, which is fixed for each implementing type.public void setScale(int newScale)
DataType.ExactNumeric
setScale
in interface DataType.ExactNumeric
newScale
- new scale value. The appropriate value depends on the current
precision and radix - precision can be modified by the user, but the
radix is fixed for each implementing type.public java.lang.String toString()
"BigDecimal"
toString
in class java.lang.Object
"BigDecimal"
public boolean accepts(java.lang.Object value)
BaseNumberDataType
accepts
in interface DataType
accepts
in class BaseNumberDataType
value
- non- null
valuepublic boolean requiresRounding(java.math.BigDecimal value)
public java.lang.Object convert(java.lang.Object value) throws AxionException
IllegalArgumentException
if the given value isn't
acceptable
.convert
in interface DataType
convert
in class BaseNumberDataType
AxionException
public java.lang.Object read(java.io.DataInput in) throws java.io.IOException
DataType
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)
.read
in interface DataType
read
in class BaseDataType
java.io.IOException
write(java.lang.Object, java.io.DataOutput)
public boolean supportsSuccessor()
false
supportsSuccessor
in interface DataType
supportsSuccessor
in class BaseNumberDataType
public java.lang.Object successor(java.lang.Object value) throws java.lang.IllegalArgumentException
DataType
successor
in interface DataType
successor
in class BaseDataType
java.lang.IllegalArgumentException
public void write(java.lang.Object value, java.io.DataOutput out) throws java.io.IOException
DataType
DataOutput
.write
in interface DataType
write
in class BaseDataType
value
- the value to write, which must be acceptable
to this
DataType
java.io.IOException
public DataType makeNewInstance()
DataType
makeNewInstance
in interface DataType
makeNewInstance
in interface DataTypeFactory
makeNewInstance
in class BaseDataType
public int compare(java.lang.Object a, java.lang.Object b)
compare
in interface java.util.Comparator
compare
in class BaseDataType
public DataType.ExactNumeric makeNewInstance(int newPrecision, int newScale)
DataType.ExactNumeric
makeNewInstance
in interface DataType.ExactNumeric
newPrecision
- precision of the new instancenewScale
- scale of the new instanceprotected java.util.Comparator getComparator()
BaseDataType
ComparableComparator
.getComparator
in class BaseDataType