public final class DefaultNumberValue extends NumberValue
NumberValue based on BigDecimal.| Modifier and Type | Field and Description |
|---|---|
static NumberValue |
ONE
The value 1, with a scale of 0.
Backed by BigDecimal.ONE |
| Constructor and Description |
|---|
DefaultNumberValue(Number number) |
| Modifier and Type | Method and Description |
|---|---|
double |
doubleValue() |
double |
doubleValueExact() |
float |
floatValue() |
long |
getAmountFractionDenominator() |
long |
getAmountFractionNumerator() |
protected static BigDecimal |
getBigDecimal(Number num)
Deprecated.
will be removed.
|
Class<?> |
getNumberType() |
int |
getPrecision() |
int |
getScale() |
int |
intValue() |
int |
intValueExact() |
long |
longValue() |
long |
longValueExact() |
<T extends Number> |
numberValue(Class<T> numberType) |
<T extends Number> |
numberValueExact(Class<T> numberType) |
static NumberValue |
of(Number number)
Creates a new instance of
NumberValue, using the given number. |
NumberValue |
round(MathContext mathContext) |
String |
toString() |
compareTobyteValue, shortValuepublic static final NumberValue ONE
BigDecimal.ONEpublic DefaultNumberValue(Number number)
public static NumberValue of(Number number)
NumberValue, using the given number.number - The numeric part, not null.NumberValue.public Class<?> getNumberType()
getNumberType in class NumberValuepublic int getPrecision()
getPrecision in class NumberValuepublic int getScale()
getScale in class NumberValuepublic int intValueExact()
intValueExact in class NumberValuepublic long longValueExact()
longValueExact in class NumberValuepublic float floatValue()
floatValue in class Numberpublic double doubleValue()
doubleValue in class Numberpublic double doubleValueExact()
doubleValueExact in class NumberValuepublic long getAmountFractionNumerator()
getAmountFractionNumerator in class NumberValuepublic long getAmountFractionDenominator()
getAmountFractionDenominator in class NumberValuepublic <T extends Number> T numberValue(Class<T> numberType)
numberValue in class NumberValuepublic NumberValue round(MathContext mathContext)
round in class NumberValuepublic <T extends Number> T numberValueExact(Class<T> numberType)
numberValueExact in class NumberValue@Deprecated protected static BigDecimal getBigDecimal(Number num)
BigDecimal from the given Number doing the valid conversion
depending the type given.num - the number typeBigDecimalCopyright © 2012–2020 JavaMoney. All rights reserved.