org.apache.solr.schema

## Interface ExchangeRateProvider

- All Known Implementing Classes:
    OpenExchangeRatesOrgProvider

      public interface ExchangeRateProvider

  Interface for providing pluggable exchange rate providers to @CurrencyField

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `getExchangeRate(String sourceCurrencyCode, String targetCurrencyCode)` Get the exchange rate between the two given currencies
    `void` | `inform(ResourceLoader loader)` Passes a ResourceLoader, used to read config files from e.g.
    `void` | `init(Map<String,String> args)` Initializes the provider by passing in a set of key/value configs as a map.
    `Set<String>` | `listAvailableCurrencies()` List all configured currency codes which are valid as source/target for this Provider
    `boolean` | `reload()` Ask the currency provider to explicitly reload/refresh its configuration.

- - ### Method Detail

    - #### getExchangeRate

          double getExchangeRate(String sourceCurrencyCode,
                                 String targetCurrencyCode)
                          throws SolrException

      Get the exchange rate between the two given currencies
      Returns:
        the exchange rate as a double
      Throws:
        `SolrException` - if the rate is not defined in the provider

    - #### listAvailableCurrencies

          Set<String> listAvailableCurrencies()

      List all configured currency codes which are valid as source/target for this Provider
      Returns:
        a Set of ISO 4217 currency code strings

    - #### reload

          boolean reload()
                  throws SolrException

      Ask the currency provider to explicitly reload/refresh its configuration. If this does not make sense for a particular provider, simply do nothing
      Returns:
        true if reload of rates succeeded, else false
      Throws:
        `SolrException` - if there is a problem reloading

    - #### init

          void init(Map<String,String> args)

      Initializes the provider by passing in a set of key/value configs as a map. Note that the map also contains other fieldType parameters, so make sure to avoid name clashes.

      Important: Custom config params must be removed from the map before returning

      Parameters:
        `args` - a @Map of key/value config params to initialize the provider

    - #### inform

          void inform(ResourceLoader loader)
               throws SolrException

      Passes a ResourceLoader, used to read config files from e.g. ZooKeeper. Implementations not needing resource loader can implement this as NOOP.

      Typically called after init

      Parameters:
        `loader` - a @ResourceLoader instance
      Throws:
        `SolrException`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.