public final class ConversionOperators extends Object
MonetaryAmount money = Money.parse("EUR 2.35");
MonetaryAmount result = operator.apply(money);
Or using:
MonetaryAmount money = Money.parse("EUR 2.35");
MonetaryAmount result = money.with(operator);
MonetaryAmount.with(MonetaryOperator),
MonetaryOperator,
MonetaryOperator.apply(MonetaryAmount)| Modifier and Type | Method and Description |
|---|---|
static MonetaryOperator |
exchange(CurrencyUnit currencyUnit)
Do exchange of currency, in other words, create the monetary amount with the
same value but with currency different.
|
public static MonetaryOperator exchange(CurrencyUnit currencyUnit)
Currency real = Monetary.getCurrency("BRL");
MonetaryAmount money = Money.parse("EUR 2.355");
MonetaryAmount result = ConversionOperators.exchangeCurrency(real).apply(money);//BRL 2.355
currencyUnit - the currencyMonetaryOperatorCopyright © 2012–2020 JavaMoney. All rights reserved.