public class DecimalValue extends DataValue
DataValue subclass that wraps a DecimalValue.value
of type decimal
.
Modifier and Type | Field and Description |
---|---|
static DecimalValue |
zero |
Modifier and Type | Method and Description |
---|---|
static int |
compare(DecimalValue left,
DecimalValue right)
Compare two wrapped values for ordering.
|
static boolean |
equal(DecimalValue left,
DecimalValue right)
Compare two wrapped values for equality.
|
boolean |
equals(java.lang.Object value)
Return
true if this object is equal to value . |
DataType |
getDataType()
Return the type BasicType.DECIMAL.
|
int |
getTypeCode()
Return data type code of the wrapped value, equivalent to
dataType.code . |
java.math.BigDecimal |
getValue()
Return the wrapped value.
|
int |
hashCode()
Hash the wrapped value to a number.
|
static DecimalValue |
of(java.math.BigDecimal value)
Wrap a
decimal value as an object. |
static DecimalValue |
ofNullable(java.math.BigDecimal value)
Wrap a nullable
decimal value as an object. |
static java.math.BigDecimal |
toNullable(java.lang.Object value)
Convert a wrapped
decimal value to a nullable decimal. |
java.lang.String |
toString()
Convert this data value to a string.
|
static java.math.BigDecimal |
unwrap(java.lang.Object value)
Convert a wrapped
decimal value to a decimal. |
cloneMutable
public static final DecimalValue zero
public static int compare(DecimalValue left, DecimalValue right)
Compare two wrapped values for ordering.
left
- First object for comparison.right
- Second object for comparison.left.value < right.value
, 0 if left.value == right.value
, or 1 if left.value > right.value
.public static boolean equal(DecimalValue left, DecimalValue right)
Compare two wrapped values for equality.
left
- (nullable) First object for comparison.right
- (nullable) Second object for comparison.true
if left.value == right.value
or if both arguments are null
, otherwise false
.public boolean equals(java.lang.Object value)
Return true
if this object is equal to value
.
public DataType getDataType()
Return the type BasicType.DECIMAL.
getDataType
in class DataValue
public int getTypeCode()
Return data type code of the wrapped value, equivalent to dataType.code
.
getTypeCode
in class DataValue
dataType.code
.public java.math.BigDecimal getValue()
Return the wrapped value.
public int hashCode()
Hash the wrapped value to a number.
public static DecimalValue of(java.math.BigDecimal value)
Wrap a decimal
value as an object.
value
- Value to be wrapped.public static DecimalValue ofNullable(java.math.BigDecimal value)
Wrap a nullable decimal
value as an object.
value
- (nullable) Value to be wrapped.public static java.math.BigDecimal toNullable(java.lang.Object value)
Convert a wrapped decimal
value to a nullable decimal.
CastException
if value
is not a wrapped decimal
or null
.
value
- (nullable) The wrapped value.public java.lang.String toString()
Convert this data value to a string.
If the DecimalValue.dataType
is defined by XML Schema Part 2: Datatypes, then the corresponding lexical format is used.
JSON format is used for structured values (arrays and objects).
public static java.math.BigDecimal unwrap(java.lang.Object value)
Convert a wrapped decimal
value to a decimal.
CastException
if value
is not a wrapped decimal
.
value
- (nullable) The wrapped value.