public final class DefaultNumberValue extends javax.money.NumberValue
NumberValue
based on BigDecimal
.Modifier and Type | Field and Description |
---|---|
static javax.money.NumberValue |
ONE
The value 1, with a scale of 0.
|
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)
Creates a
BigDecimal from the given Number doing the valid conversion
depending the type given. |
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 javax.money.NumberValue |
of(Number number)
Creates a new instance of
NumberValue , using the given number. |
javax.money.NumberValue |
round(MathContext mathContext) |
String |
toString() |
byteValue, shortValue
public static final javax.money.NumberValue ONE
BigDecimal.ONE
public DefaultNumberValue(Number number)
public static javax.money.NumberValue of(Number number)
NumberValue
, using the given number.number
- The numeric part, not null.NumberValue
.public Class<?> getNumberType()
getNumberType
in class javax.money.NumberValue
public int getPrecision()
getPrecision
in class javax.money.NumberValue
public int getScale()
getScale
in class javax.money.NumberValue
public int intValueExact()
intValueExact
in class javax.money.NumberValue
public long longValueExact()
longValueExact
in class javax.money.NumberValue
public float floatValue()
floatValue
in class Number
public double doubleValue()
doubleValue
in class Number
public double doubleValueExact()
doubleValueExact
in class javax.money.NumberValue
public long getAmountFractionNumerator()
getAmountFractionNumerator
in class javax.money.NumberValue
public long getAmountFractionDenominator()
getAmountFractionDenominator
in class javax.money.NumberValue
public <T extends Number> T numberValue(Class<T> numberType)
numberValue
in class javax.money.NumberValue
public javax.money.NumberValue round(MathContext mathContext)
round
in class javax.money.NumberValue
public <T extends Number> T numberValueExact(Class<T> numberType)
numberValueExact
in class javax.money.NumberValue
protected static BigDecimal getBigDecimal(Number num)
BigDecimal
from the given Number
doing the valid conversion
depending the type given.num
- the number typeBigDecimal
Copyright © 2012-2015 JavaMoney. All Rights Reserved.