public interface CurrencyConversion extends MonetaryOperator, CurrencySupplier
CurrencyConversionthat is converting a
MonetaryAmountwith a different target
CurrencyUnit. Each instance of this class is bound to a specific
ExchangeRateProvider(or a chain of rate providers), a term
CurrencyUnitand (optionally) a target timestamp. Additionally the
ConversionContextcan have additional attributes set that are passed to the rate provider (chain).
This interface serves a an API for the clients, but also must be implemented
and registered as SPI to the mechanisms required by the
MonetaryAmount amount = ...; CurrencyConversion conversion = MonetaryConversions.getConversion("CHF"); MonetaryAmount amountInCHF = amount.with(conversion);
CurrencyUnit of this conversion instance can be
getCurrency(), inherited from
Instances of this class are required to be thread-safe, but it is not a requirement that they are serializable. In a EE context they can be implemented using contextual beans.
|Modifier and Type||Method and Description|
Access the target
Access the underlying
ConversionContextof this conversion instance.
ExchangeRate getExchangeRate(MonetaryAmount sourceAmount)
Copyright © 2012–2016 JSR 354 - Expert Group. All rights reserved.