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) |
public AbstractCurrencyConversion(javax.money.CurrencyUnit termCurrency, javax.money.convert.ConversionContext conversionContext)
public javax.money.CurrencyUnit getTermCurrency()
CurrencyUnit
of this conversion instance.getTermCurrency
in interface javax.money.convert.CurrencyConversion
CurrencyUnit
, never null
.public javax.money.convert.ConversionContext getConversionContext()
ConversionContext
of this conversion instance.getConversionContext
in interface javax.money.convert.CurrencyConversion
ConversionContext
.public abstract javax.money.convert.ExchangeRate getExchangeRate(javax.money.MonetaryAmount amount)
MonetaryOperator
instance is
using for conversion.getExchangeRate
in interface javax.money.convert.CurrencyConversion
ExchangeRate
to be used, or null, if this conversion
is not supported (will lead to a
CurrencyConversionException
.apply(MonetaryAmount)
public abstract javax.money.convert.CurrencyConversion with(javax.money.convert.ConversionContext conversionContext)
with
in interface javax.money.convert.CurrencyConversion
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.MonetaryOperator
amount
- The source amountjavax.money.convert.CurrencyConversionException
- if conversion failed, or the required data is not available.getExchangeRate(MonetaryAmount)
public java.lang.String toString()
toString
in class java.lang.Object