Top Description Constructors Methods
org.javamoney.moneta.convert

public final Class ConversionOperators

extends Object
Class Inheritance
Imports
java.util.Objects, java.util.function.Supplier, java.util.stream.Collector, javax.money.CurrencyUnit, .MonetaryAmount, .MonetaryOperator, javax.money.convert.ExchangeRateProvider, org.javamoney.moneta.convert.ExchangeCurrencyOperator, org.javamoney.moneta.function.MonetarySummaryStatistics

This singleton class provides access to the predefined monetary functions.

The class is thread-safe, which is also true for all functions returned by this class.

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);

Author
Werner Keil
Since
1.0.1
See Also
MonetaryAmount#with(MonetaryOperator), MonetaryOperator, MonetaryOperator#apply(MonetaryAmount)

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static MonetaryOperator

Returns:

the major part as MonetaryOperator
exchange
(CurrencyUnit
the currency to be used
currencyUnit
)

Do exchange of currency, in other words, create the monetary amount with the same value but with currency different.

public static Collector<MonetaryAmount, MonetarySummaryStatistics, MonetarySummaryStatistics>

Returns:

the MonetarySummaryStatistics
summarizingMonetary
(CurrencyUnit currencyUnit, ExchangeRateProvider provider)

of the summary of the MonetaryAmount

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConversionOperatorsback to summary
private ConversionOperators()

Method Detail

exchangeback to summary
public static MonetaryOperator exchange(CurrencyUnit currencyUnit)

Do exchange of currency, in other words, create the monetary amount with the same value but with currency different.

For example, 'EUR 2.35', using the currency 'USD' as exchange parameter, will return 'USD 2.35', and 'BHD -1.345', using the currency 'USD' as exchange parameter, will return 'BHD -1.345'.

Currency real = Monetary.getCurrency("BRL");
MonetaryAmount money = Money.parse("EUR 2.355");
MonetaryAmount result = ConversionOperators.exchangeCurrency(real).apply(money);//BRL 2.355

Parameters
currencyUnit:CurrencyUnit

the currency to be used

Returns:MonetaryOperator

the major part as MonetaryOperator

Since
1.0.1
summarizingMonetaryback to summary
public static Collector<MonetaryAmount, MonetarySummaryStatistics, MonetarySummaryStatistics> summarizingMonetary(CurrencyUnit currencyUnit, ExchangeRateProvider provider)

of the summary of the MonetaryAmount

Parameters
currencyUnit:CurrencyUnit

the target javax.money.CurrencyUnit

Returns:Collector<MonetaryAmount, MonetarySummaryStatistics, MonetarySummaryStatistics>

the MonetarySummaryStatistics