Package org.openhab.core.library.unit
Interface CurrencyProvider
@NonNullByDefault
public interface CurrencyProvider
The
CurrencyProvider
can be implemented by services that supply currencies and their exchange rates- Author:
- Jan N. Klug - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionCollection
<javax.measure.Unit<Currency>> Get all additional currency that are supported by this providerjavax.measure.Unit
<Currency> Get the base currency from this providerFunction
<javax.measure.Unit<Currency>, @Nullable BigDecimal> Get aFunction
that supplies exchanges rates for currencies supported by this providerdefault String
getName()
Get the name of thisCurrencyProvider
-
Method Details
-
getName
Get the name of thisCurrencyProvider
- Returns:
- the name, defaults to the class name
-
getBaseCurrency
javax.measure.Unit<Currency> getBaseCurrency()Get the base currency from this provider This currency is used as base for calculating exchange rates.- Returns:
- the base currency of this provider
-
getAdditionalCurrencies
Collection<javax.measure.Unit<Currency>> getAdditionalCurrencies()Get all additional currency that are supported by this provider The collection does NOT include the base currency.- Returns:
- a
Collection
ofjavax.measure.Unit<Currency>
s
-
getExchangeRateFunction
Function<javax.measure.Unit<Currency>,@Nullable BigDecimal> getExchangeRateFunction()Get aFunction
that supplies exchanges rates for currencies supported by this provider This needs to be dynamic because in most cases exchange rates are not constant over time.- Returns:
- the function
-