public abstract class Decimal<T extends Decimal<T>>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
double |
doubleValue()
Converts this decimal to a double value.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
java.math.BigDecimal |
toBigDecimal()
Converts this decimal to a
BigDecimal . |
byte[] |
toBytes()
Converts this decimal to its IEEE-754 byte encoding in network byte-order (aka big-endian).
|
<D extends Decimal<D>> |
toDecimal(java.lang.Class<D> decimalType)
Converts this decimal to the requested decimal type, rounding when necessary.
|
<D extends Decimal<D>> |
toDecimal(java.lang.Class<D> decimalType,
OverflowHandling overflowHandling)
Converts this decimal to the requested decimal type, rounding when necessary.
|
java.lang.String |
toString() |
public final java.math.BigDecimal toBigDecimal()
BigDecimal
.DecimalInconvertibleException
- If this value is a NaN, sNaN or Infinity, which can't be represented as a BigDecimal
.public final double doubleValue()
For normal, finite, decimal values, see BigDecimal.doubleValue()
.
For type INFINITY, returns Double.POSITIVE_INFINITY
or Double.NEGATIVE_INFINITY
. For all
NaN-specials, returns Double.NaN
(irrespective of signum).
double
public final byte[] toBytes()
This method returns network byte-order (aka big-endian). When you need little-endian order, you will need to reverse the bytes in the array.
public final <D extends Decimal<D>> D toDecimal(java.lang.Class<D> decimalType)
D
- Type parameter of decimaldecimalType
- Target decimal typedecimalType
is the same as this typejava.lang.IllegalArgumentException
- If conversion to decimalType
is not supportedpublic final <D extends Decimal<D>> D toDecimal(java.lang.Class<D> decimalType, OverflowHandling overflowHandling)
D
- Type parameter of decimaldecimalType
- Target decimal typeoverflowHandling
- Handling of overflowsdecimalType
is the same as this typejava.lang.IllegalArgumentException
- If conversion to decimalType
is not supportedDecimalOverflowException
- If OverflowHandling#THROW_EXCEPTION
and the value is out of range for the target decimal type.public final java.lang.String toString()
toString
in class java.lang.Object
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
Copyright © 2001-2023 Jaybird (Firebird JDBC) team. All rights reserved.