public class ExchangeRateBuilder extends Object
ExchangeRate. Note that
instances of this class are not thread-safe.| Constructor and Description |
|---|
ExchangeRateBuilder(ConversionContext context)
Sets the exchange rate type
|
ExchangeRateBuilder(ExchangeRate rate)
Sets the exchange rate type
|
ExchangeRateBuilder(String provider,
RateType rateType)
Sets the exchange rate type
|
| Modifier and Type | Method and Description |
|---|---|
ExchangeRate |
build()
Builds a new instance of
ExchangeRate. |
ExchangeRateBuilder |
setBase(CurrencyUnit base)
Sets the base
CurrencyUnit |
ExchangeRateBuilder |
setContext(ConversionContext conversionContext)
Sets the provider to be applied.
|
ExchangeRateBuilder |
setFactor(NumberValue factor)
Sets the conversion factor, as the factor
base * factor = target. |
ExchangeRateBuilder |
setRate(ExchangeRate rate)
Initialize the
ExchangeRateBuilder with an ExchangeRate. |
ExchangeRateBuilder |
setRateChain(ExchangeRate... exchangeRates)
Sets the
ExchangeRate chain. |
ExchangeRateBuilder |
setRateChain(List<ExchangeRate> exchangeRates)
Sets the
ExchangeRate chain. |
ExchangeRateBuilder |
setTerm(CurrencyUnit term)
Sets the terminating (target)
CurrencyUnit |
String |
toString() |
public ExchangeRateBuilder(String provider, RateType rateType)
rateType - the RateType containedpublic ExchangeRateBuilder(ConversionContext context)
context - the ConversionContext to be appliedpublic ExchangeRateBuilder(ExchangeRate rate)
rate - the ExchangeRate to be appliedpublic ExchangeRateBuilder setBase(CurrencyUnit base)
CurrencyUnitbase - to base (source) CurrencyUnit to be appliedpublic ExchangeRateBuilder setTerm(CurrencyUnit term)
CurrencyUnitterm - to terminating CurrencyUnit to be appliedpublic ExchangeRateBuilder setRateChain(ExchangeRate... exchangeRates)
ExchangeRate chain.exchangeRates - the ExchangeRate chain to be appliedpublic ExchangeRateBuilder setRateChain(List<ExchangeRate> exchangeRates)
ExchangeRate chain.exchangeRates - the ExchangeRate chain to be appliedpublic ExchangeRateBuilder setFactor(NumberValue factor)
base * factor = target.factor - the factor.public ExchangeRateBuilder setContext(ConversionContext conversionContext)
conversionContext - the ConversionContext, not null.public ExchangeRate build()
ExchangeRate.ExchangeRate.IllegalArgumentException - if the rate could not be built.public ExchangeRateBuilder setRate(ExchangeRate rate)
ExchangeRateBuilder with an ExchangeRate. This is
useful for creating a new rate, reusing some properties from an
existing one.rate - the base rateCopyright © 2012–2020 JavaMoney. All rights reserved.