MonetaryAmount based on
BigDecimal for the numeric representation.
As required by MonetaryAmount this class is final, thread-safe, immutable and
serializable.
| Modifier and Type | Field and Description |
|---|---|
| private final CurrencyUnit | currency
The currency of this amount. |
| public static final MonetaryContext | DEFAULT_MONETARY_CONTEXT
The default |
| private final MonetaryContext | monetaryContext
the |
| private final BigDecimal | number
The numeric part of this amount. |
| private final MonetaryOperator | rounding
The rounding to be done. |
| private static final long | serialVersionUID
serialVersionUID. |
| Access | Constructor and Description |
|---|---|
| public | RoundedMoney(Number
the amount, not null. number, CurrencyUnit the currency, not null. currency, MonetaryOperator rounding)Creates a new instance of |
| public | |
| public | RoundedMoney(Number number, CurrencyUnit currency, MonetaryContext context, MonetaryOperator rounding)
Deprecated
|
| Modifier and Type | Method and Description |
|---|---|
| public RoundedMoney | abs()
Implements javax. Returns a |
| public RoundedMoney | add(MonetaryAmount amount)
Implements javax. Returns a |
| public BigDecimal | Returns: the stripped number value.Method that returns BigDecimal.ZERO, if |
| public <T> T | |
| public <T> T | |
| private void | checkNumber(Number
the number to check. number)Internal method to check for correct number parameter. |
| public int | compareTo(MonetaryAmount o)
Implements java. Compares this object with the specified object for order. |
| private static MonetaryAmountFormat | |
| public RoundedMoney | divide(Number divisor)
Implements javax. Returns a |
| public RoundedMoney | divide(long divisor)
Implements javax. Returns a |
| public RoundedMoney | divide(double divisor)
Implements javax. Returns a |
| public RoundedMoney[] | divideAndRemainder(Number divisor)
Implements javax. Returns a two-element |
| public RoundedMoney[] | divideAndRemainder(long divisor)
Implements javax. Returns a two-element |
| public RoundedMoney[] | divideAndRemainder(double divisor)
Implements javax. Returns a two-element |
| public RoundedMoney | divideToIntegralValue(Number divisor)
Implements javax. Returns a |
| public RoundedMoney | divideToIntegralValue(long divisor)
Implements javax. Returns a |
| public RoundedMoney | divideToIntegralValue(double divisor)
Implements javax. Returns a |
| public boolean | equals(Object obj)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public static RoundedMoney | |
| public MonetaryContext | Returns: theMathContext used, never null.Implements javax. Access the |
| public CurrencyUnit | getCurrency()
Implements javax. Gets the corresponding |
| public MonetaryAmountFactory | getFactory()
Implements javax. Creates a new |
| public NumberValue | getNumber()
Implements javax. Gets the corresponding |
| public int | Returns: the precision of thisRoundedMoney.Returns the precision of this |
| public int | |
| public int | |
| public boolean | isEqualTo(MonetaryAmount amount)
Implements javax. Compares two instances of |
| public boolean | isGreaterThan(MonetaryAmount amount)
Implements javax. Compares two instances of |
| public boolean | isGreaterThanOrEqualTo(MonetaryAmount amount)
Implements javax. Compares two instances of |
| public boolean | isLessThan(MonetaryAmount amount)
Implements javax. Compares two instances of |
| public boolean | isLessThanOrEqualTo(MonetaryAmount amount)
Implements javax. Compares two instances of |
| public boolean | isNegative()
Overrides default javax. Checks if a |
| public boolean | isNegativeOrZero()
Overrides default javax. Checks if a |
| public boolean | |
| private boolean | |
| public boolean | isPositive()
Overrides default javax. Checks if a |
| public boolean | isPositiveOrZero()
Overrides default javax. Checks if a |
| public boolean | |
| public RoundedMoney | multiply(Number multiplicand)
Implements javax. Returns a |
| public RoundedMoney | multiply(long multiplicand)
Implements javax. Returns a |
| public RoundedMoney | multiply(double multiplicand)
Implements javax. Returns a |
| public RoundedMoney | negate()
Implements javax. Returns a |
| public static RoundedMoney | Returns: aMoney combining the numeric value and currency unit.numeric value of the number, CurrencyUnit Money.currency unit of the currency)Money.Translates a |
| public static RoundedMoney | Returns: aMoney combining the numeric value and currency unit.numeric value of the number, CurrencyUnit Money.currency unit of the currency, MonetaryOperator Money.The rounding to be applied. rounding)Translates a |
| public static RoundedMoney | Returns: aMoney combining the numeric value and currency unit.numeric value of the number, CurrencyUnit Money.currency unit of the currency, MathContext Money.the mathContext)MathContext to be used.Translates a |
| public static RoundedMoney | Returns: A new instance ofRoundedMoney.The numeric part, not null. number, CurrencyUnit The target currency, not null. currency)
Deprecated
Static factory method for creating a new instance of |
| public static RoundedMoney | Returns: A new instance ofRoundedMoney.The numeric part, not null. number, CurrencyUnit The target currency, not null. currency, MonetaryOperator The rounding to be applied. rounding)Static factory method for creating a new instance of |
| public static RoundedMoney | Returns: A new instance ofRoundedMoney.The numeric part, not null. number, CurrencyUnit The target currency, not null. currency, MonetaryContext monetaryContext)Static factory method for creating a new instance of |
| public static RoundedMoney | Returns: A new instance ofRoundedMoney.The target currency, not null. currency, Number The numeric part, not null. number, MonetaryContext the monetaryContext, MonetaryOperator MonetaryContext to be used.The rounding to be applied. rounding)
Deprecated
Static factory method for creating a new instance of |
| public static RoundedMoney | Returns: A new instance ofRoundedMoney.The numeric part, not null. number, String The target currency as ISO currency code. currencyCode)
Deprecated
Static factory method for creating a new instance of |
| public static RoundedMoney | Returns: A new instance ofRoundedMoney.The numeric part, not null. number, String The target currency as ISO currency code. currencyCode, MonetaryOperator The rounding to be applied. rounding)Static factory method for creating a new instance of |
| public static RoundedMoney | Returns: A new instance ofRoundedMoney.The numeric part, not null. number, String The target currency as ISO currency code. currencyCode, MonetaryContext monetaryContext)
Deprecated
Static factory method for creating a new instance of |
| public static RoundedMoney | Returns: A new instance ofRoundedMoney.The target currency as ISO currency code. currencyCode, Number The numeric part, not null. number, MonetaryContext monetaryContext, MonetaryOperator The rounding to be applied. rounding)Static factory method for creating a new instance of |
| public static RoundedMoney | Returns: the Money from minor unitsthe currency, not null currency, long the amount of money in the minor division of the currency amountMinor)Obtains an instance of |
| public static RoundedMoney | Returns: the monetary amount from minor unitsthe currency, not null currency, long the amount of money in the minor division of the currency amountMinor, int number of digits factionDigits)Obtains an instance of |
| public static RoundedMoney | Returns: RoundedMoney instancethe input text, not null. text)Obtains an instance of RoundedMoney from a text string such as 'EUR 25.25'. |
| public static RoundedMoney | Returns: RoundedMoney instancethe text to parse not null text, MonetaryAmountFormat the formatter to use not null formatter)Obtains an instance of FastMoney from a text using specific formatter. |
| public RoundedMoney | |
| public RoundedMoney | |
| public <T> T | query(MonetaryQuery<T> query)
Overrides default javax. Queries this monetary amount for a value. |
| public RoundedMoney | remainder(Number divisor)
Implements javax. Returns a |
| public RoundedMoney | remainder(long divisor)
Implements javax. Returns a |
| public RoundedMoney | remainder(double divisor)
Implements javax. Returns a |
| public RoundedMoney | scaleByPowerOfTen(int power)
Implements javax. Returns a |
| public int | signum()
Implements javax. Returns the signum function of this |
| public RoundedMoney | stripTrailingZeros()
Implements javax. Returns a |
| public RoundedMoney | subtract(MonetaryAmount amount)
Implements javax. Returns a |
| public String | |
| public RoundedMoney | |
| public RoundedMoney | |
| public RoundedMoney | with(CurrencyUnit
the currency unit to be replaced, not currency)nullCreates a new Money instance, by just replacing the |
| public RoundedMoney | |
| public RoundedMoney | with(MonetaryOperator operator)
Overrides default javax. Returns an operated object of the same type as this object with the operation made. |
| public static RoundedMoney | Returns: an instance ofRoundedMoney representing zero.the currency, not null. currency)Obtains an instance of |