public static class ExchangeRate.Builder
extends java.lang.Object
ExchangeRate. Note that
instances of this class are not thread-safe.| Constructor and Description |
|---|
ExchangeRate.Builder(ConversionContext context)
Sets the exchange rate type
|
ExchangeRate.Builder(java.lang.String provider,
RateType rateType)
Sets the exchange rate type
|
| Modifier and Type | Method and Description |
|---|---|
ExchangeRate |
create()
Builds a new instance of
ExchangeRate. |
ExchangeRate.Builder |
setBase(CurrencyUnit base)
Sets the base
CurrencyUnit |
ExchangeRate.Builder |
setContext(ConversionContext conversionContext)
Sets the provider to be applied.
|
ExchangeRate.Builder |
setFactor(NumberValue factor)
Sets the conversion factor, as the factor
base * factor = target. |
ExchangeRate.Builder |
setRate(ExchangeRate rate)
Initialize the
ExchangeRate.Builder with an ExchangeRate. |
ExchangeRate.Builder |
setRateChain(ExchangeRate... exchangeRates)
Sets the
ExchangeRate chain. |
ExchangeRate.Builder |
setTerm(CurrencyUnit term)
Sets the terminating (target)
CurrencyUnit |
public ExchangeRate.Builder(ConversionContext context)
context - the ConversionContext to be appliedpublic ExchangeRate create()
ExchangeRate.ExchangeRate.java.lang.IllegalArgumentException - if the rate could not be build.public ExchangeRate.Builder setBase(CurrencyUnit base)
CurrencyUnitbase - to base (source) CurrencyUnit to be appliedpublic ExchangeRate.Builder setContext(ConversionContext conversionContext)
conversionContext - the ConversionContext, not null.public ExchangeRate.Builder setFactor(NumberValue factor)
base * factor = target.factor - the factor.public ExchangeRate.Builder setRate(ExchangeRate rate)
ExchangeRate.Builder with an ExchangeRate. This is
useful for creating a new rate, reusing some properties from an
existing one.rate - the base ratepublic ExchangeRate.Builder setRateChain(ExchangeRate... exchangeRates)
ExchangeRate chain.exchangeRates - the ExchangeRate chain to be appliedpublic ExchangeRate.Builder setTerm(CurrencyUnit term)
CurrencyUnitterm - to terminating CurrencyUnit to be applied