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 Details

    • getName

      default String getName()
      Get the name of this CurrencyProvider
      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 of javax.measure.Unit<Currency>s
    • getExchangeRateFunction

      Function<javax.measure.Unit<Currency>,@Nullable BigDecimal> getExchangeRateFunction()
      Get a Function 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