public class ExchangeRateBuilder extends Object
ExchangeRate
. Note that
instances of this class are not thread-safe.Constructor and Description |
---|
ExchangeRateBuilder(javax.money.convert.ConversionContext context)
Sets the exchange rate type
|
ExchangeRateBuilder(javax.money.convert.ExchangeRate rate)
Sets the exchange rate type
|
ExchangeRateBuilder(String provider,
javax.money.convert.RateType rateType)
Sets the exchange rate type
|
Modifier and Type | Method and Description |
---|---|
javax.money.convert.ExchangeRate |
build()
Builds a new instance of
ExchangeRate . |
ExchangeRateBuilder |
setBase(javax.money.CurrencyUnit base)
Sets the base
CurrencyUnit |
ExchangeRateBuilder |
setContext(javax.money.convert.ConversionContext conversionContext)
Sets the provider to be applied.
|
ExchangeRateBuilder |
setFactor(javax.money.NumberValue factor)
Sets the conversion factor, as the factor
base * factor = target . |
ExchangeRateBuilder |
setRate(javax.money.convert.ExchangeRate rate)
Initialize the
ExchangeRateBuilder with an ExchangeRate . |
ExchangeRateBuilder |
setRateChain(javax.money.convert.ExchangeRate... exchangeRates)
Sets the
ExchangeRate chain. |
ExchangeRateBuilder |
setRateChain(List<javax.money.convert.ExchangeRate> exchangeRates)
Sets the
ExchangeRate chain. |
ExchangeRateBuilder |
setTerm(javax.money.CurrencyUnit term)
Sets the terminating (target)
CurrencyUnit |
String |
toString() |
public ExchangeRateBuilder(String provider, javax.money.convert.RateType rateType)
rateType
- the RateType
containedpublic ExchangeRateBuilder(javax.money.convert.ConversionContext context)
context
- the ConversionContext
to be appliedpublic ExchangeRateBuilder(javax.money.convert.ExchangeRate rate)
rate
- the ExchangeRate
to be appliedpublic ExchangeRateBuilder setBase(javax.money.CurrencyUnit base)
CurrencyUnit
base
- to base (source) CurrencyUnit
to be appliedpublic ExchangeRateBuilder setTerm(javax.money.CurrencyUnit term)
CurrencyUnit
term
- to terminating CurrencyUnit
to be appliedpublic ExchangeRateBuilder setRateChain(javax.money.convert.ExchangeRate... exchangeRates)
ExchangeRate
chain.exchangeRates
- the ExchangeRate
chain to be appliedpublic ExchangeRateBuilder setRateChain(List<javax.money.convert.ExchangeRate> exchangeRates)
ExchangeRate
chain.exchangeRates
- the ExchangeRate
chain to be appliedpublic ExchangeRateBuilder setFactor(javax.money.NumberValue factor)
base * factor = target
.factor
- the factor.public ExchangeRateBuilder setContext(javax.money.convert.ConversionContext conversionContext)
conversionContext
- the ConversionContext
, not null.public javax.money.convert.ExchangeRate build()
ExchangeRate
.ExchangeRate
.IllegalArgumentException
- if the rate could not be built.public ExchangeRateBuilder setRate(javax.money.convert.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-2015 JavaMoney. All Rights Reserved.