Interface ExchangeRateProvider

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      double getExchangeRate​(String sourceCurrencyCode, String targetCurrencyCode)
      Get the exchange rate between the two given currencies
      void inform​(org.apache.lucene.util.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 org.apache.solr.common.SolrException
        Get the exchange rate between the two given currencies
        Returns:
        the exchange rate as a double
        Throws:
        org.apache.solr.common.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 org.apache.solr.common.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:
        org.apache.solr.common.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​(org.apache.lucene.util.ResourceLoader loader)
             throws org.apache.solr.common.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:
        org.apache.solr.common.SolrException