Top Description Methods
javax.money.convert

public Interface ExchangeRate

extends CurrencySupplier
Imports
javax.money.CurrencySupplier, .CurrencyUnit, .NumberValue, java.io.Serializable, java.util.List

This class models an exchange rate, which defines the factor the numeric value of a base amount in some currency 'A' must be multiplied to get the corresponding amount in the terminating currency 'B'. Hereby

The class also implements Comparable to allow sorting of multiple exchange rates using the following sorting order;

Finally ExchangeRate is modeled as an immutable and thread safe type. Also exchange rates are Serializable, hereby serializing in the following form and order:

Implementation Specification

Implementations of this interface

Authors
Werner Keil, Anatole Tresch
See Also
Wikipedia: Exchange Rate (Quotations)

Method Summary

Modifier and TypeMethod and Description
public CurrencyUnit

Returns:

the base CurrencyUnit.
getBaseCurrency
()

Get the base (source) CurrencyUnit.

public ConversionContext

Returns:

the conversion context, never null.
getContext
()

Access the ConversionContext of ExchangeRate.

public CurrencyUnit

Returns:

the term CurrencyUnit.
getCurrency
()

Redeclares javax.money.CurrencySupplier.getCurrency.

Get the term (target) CurrencyUnit.
public List<ExchangeRate>

Returns:

the chain of rates, in case of a derived rate, this may be several instances. For a direct exchange rate, this equals to new ExchangeRate[]{this}.
getExchangeRateChain
()

Access the chain of exchange rates.

public NumberValue

Returns:

the bid factor for this exchange rate, or null.
getFactor
()

Access the rate's bid factor.

public default boolean

Returns:

true, if the exchange rate is derived.
isDerived
()

Allows to evaluate if this exchange rate is a derived exchange rate.

Method Detail

getBaseCurrencyback to summary
public CurrencyUnit getBaseCurrency()

Get the base (source) CurrencyUnit.

Returns:CurrencyUnit

the base CurrencyUnit.

getContextback to summary
public ConversionContext getContext()

Access the ConversionContext of ExchangeRate.

Returns:ConversionContext

the conversion context, never null.

getCurrencyback to summary
public CurrencyUnit getCurrency()

Redeclares javax.money.CurrencySupplier.getCurrency.

Get the term (target) CurrencyUnit.

Returns:CurrencyUnit

the term CurrencyUnit.

Annotations
@Override
getExchangeRateChainback to summary
public List<ExchangeRate> getExchangeRateChain()

Access the chain of exchange rates.

Returns:List<ExchangeRate>

the chain of rates, in case of a derived rate, this may be several instances. For a direct exchange rate, this equals to new ExchangeRate[]{this}.

getFactorback to summary
public NumberValue getFactor()

Access the rate's bid factor.

Returns:NumberValue

the bid factor for this exchange rate, or null.

isDerivedback to summary
public default boolean isDerived()

Allows to evaluate if this exchange rate is a derived exchange rate. Derived exchange rates are defined by an ordered list of subconversions with intermediate steps, whereas a direct conversion is possible in one steps.

This method always returns true, if the chain contains more than one rate. Direct rates, have also a chain, but with exact one rate.

Returns:boolean

true, if the exchange rate is derived.