Package org.firebirdsql.extern.decimal
Class Decimal<T extends Decimal<T>>
- java.lang.Object
- 
- org.firebirdsql.extern.decimal.Decimal<T>
 
- 
- Direct Known Subclasses:
- Decimal128,- Decimal32,- Decimal64
 
 public abstract class Decimal<T extends Decimal<T>> extends java.lang.ObjectAbstract base class for IEEE-754 decimals.- Author:
- Mark Rotteveel
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledoubleValue()Converts this decimal to a double value.booleanequals(java.lang.Object o)inthashCode()java.math.BigDecimaltoBigDecimal()Converts this decimal to aBigDecimal.byte[]toBytes()Converts this decimal to its IEEE-754 byte encoding in network byte-order (aka big-endian).<D extends Decimal<D>>
 DtoDecimal(java.lang.Class<D> decimalType)Converts this decimal to the requested decimal type, rounding when necessary.<D extends Decimal<D>>
 DtoDecimal(java.lang.Class<D> decimalType, OverflowHandling overflowHandling)Converts this decimal to the requested decimal type, rounding when necessary.java.lang.StringtoString()
 
- 
- 
- 
Method Detail- 
toBigDecimalpublic final java.math.BigDecimal toBigDecimal() Converts this decimal to aBigDecimal.- Returns:
- Value as BigDecimal
- Throws:
- DecimalInconvertibleException- If this value is a NaN, sNaN or Infinity, which can't be represented as a- BigDecimal.
 
 - 
doubleValuepublic final double doubleValue() Converts this decimal to a double value.For normal, finite, decimal values, see BigDecimal.doubleValue().For type INFINITY, returns Double.POSITIVE_INFINITYorDouble.NEGATIVE_INFINITY. For all NaN-specials, returnsDouble.NaN(irrespective of signum).- Returns:
- this decimal converted to a double
 
 - 
toBytespublic final byte[] toBytes() Converts this decimal to its IEEE-754 byte encoding in network byte-order (aka big-endian).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. - Returns:
- byte array
 
 - 
toDecimalpublic final <D extends Decimal<D>> D toDecimal(java.lang.Class<D> decimalType) Converts this decimal to the requested decimal type, rounding when necessary.- Type Parameters:
- D- Type parameter of decimal
- Parameters:
- decimalType- Target decimal type
- Returns:
- This value after conversion, or this if decimalTypeis the same as this type
- Throws:
- java.lang.IllegalArgumentException- If conversion to- decimalTypeis not supported
 
 - 
toDecimalpublic final <D extends Decimal<D>> D toDecimal(java.lang.Class<D> decimalType, OverflowHandling overflowHandling) Converts this decimal to the requested decimal type, rounding when necessary.- Type Parameters:
- D- Type parameter of decimal
- Parameters:
- decimalType- Target decimal type
- overflowHandling- Handling of overflows
- Returns:
- This value after conversion, or this if decimalTypeis the same as this type
- Throws:
- java.lang.IllegalArgumentException- If conversion to- decimalTypeis not supported
- DecimalOverflowException- If- OverflowHandling#THROW_EXCEPTIONand the value is out of range for the target decimal type.
 
 - 
toStringpublic final java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
equalspublic final boolean equals(java.lang.Object o) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic final int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 
- 
 
-