public abstract class AbstractCurrencyConversion extends 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 |
---|---|
javax.money.MonetaryAmount |
apply(javax.money.MonetaryAmount amount)
Method that converts the source
MonetaryAmount to an
MonetaryAmount based on the ExchangeRate of this
conversion. |
javax.money.convert.ConversionContext |
getContext()
Access the target
ConversionContext of this conversion instance. |
javax.money.CurrencyUnit |
getCurrency()
Access the terminating
CurrencyUnit 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. |
protected javax.money.NumberValue |
roundFactor(javax.money.MonetaryAmount amount,
javax.money.NumberValue factor)
Optionally rounds the factor to be used.
|
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 getCurrency()
CurrencyUnit
of this conversion instance.getCurrency
in interface javax.money.CurrencySupplier
CurrencyUnit
, never null
.public javax.money.convert.ConversionContext getContext()
ConversionContext
of this conversion instance.getContext
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)
public javax.money.MonetaryAmount apply(javax.money.MonetaryAmount 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)
protected javax.money.NumberValue roundFactor(javax.money.MonetaryAmount amount, javax.money.NumberValue factor)
amount
- the amount, not null.factor
- the factorCopyright © 2012-2015 JavaMoney. All Rights Reserved.