public abstract class AbstractCurrencyConversion
extends java.lang.Object
implements javax.money.convert.CurrencyConversion
| Constructor and Description |
|---|
AbstractCurrencyConversion(javax.money.CurrencyUnit termCurrency,
javax.money.convert.ConversionContext conversionContext) |
| Modifier and Type | Method and Description |
|---|---|
<T extends javax.money.MonetaryAmount> |
apply(T amount)
Method that converts the source
MonetaryAmount to an
MonetaryAmount based on the ExchangeRate of this
conversion. |
javax.money.convert.ConversionContext |
getConversionContext()
Access the target
ConversionContext of this conversion instance. |
abstract javax.money.convert.ExchangeRate |
getExchangeRate(javax.money.MonetaryAmount amount)
Get the exchange rate type that this
MonetaryOperator instance is
using for conversion. |
javax.money.CurrencyUnit |
getTermCurrency()
Access the terminating
CurrencyUnit of this conversion instance. |
java.lang.String |
toString() |
abstract javax.money.convert.CurrencyConversion |
with(javax.money.convert.ConversionContext conversionContext)
Get a new
CurrencyConversionusing the given
ConversionContext with additional attributes. |
public AbstractCurrencyConversion(javax.money.CurrencyUnit termCurrency,
javax.money.convert.ConversionContext conversionContext)
public <T extends javax.money.MonetaryAmount> T apply(T amount)
MonetaryAmount to an
MonetaryAmount based on the ExchangeRate of this
conversion.apply in interface javax.money.MonetaryOperatoramount - The source amountjavax.money.convert.CurrencyConversionException - if conversion failed, or the required data is not available.getExchangeRate(MonetaryAmount)public javax.money.convert.ConversionContext getConversionContext()
ConversionContext of this conversion instance.getConversionContext in interface javax.money.convert.CurrencyConversionConversionContext.public abstract javax.money.convert.ExchangeRate getExchangeRate(javax.money.MonetaryAmount amount)
MonetaryOperator instance is
using for conversion.getExchangeRate in interface javax.money.convert.CurrencyConversionamount - the amount to be converted.ExchangeRate to be used, or null, if this conversion
is not supported (will lead to a
CurrencyConversionException.apply(MonetaryAmount)public javax.money.CurrencyUnit getTermCurrency()
CurrencyUnit of this conversion instance.getTermCurrency in interface javax.money.convert.CurrencyConversionCurrencyUnit , never null.public java.lang.String toString()
toString in class java.lang.Objectpublic abstract javax.money.convert.CurrencyConversion with(javax.money.convert.ConversionContext conversionContext)
javax.money.convert.CurrencyConversionCurrencyConversionusing the given
ConversionContext with additional attributes.with in interface javax.money.convert.CurrencyConversionconversionContext - the ConversionContext to be applied, not nullCurrencyConversion, based on this
instance, but with a changed ConversionContext to be
applied. if the amount can not be converted.