ExchangeRateProvider (Solr 3.6.2 API)
Keywords: org.apache.solr.schema.ExchangeRateProvider interface

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.schema
Interface ExchangeRateProvider

    public interface ExchangeRateProvider

Interface for providing pluggable exchange rate providers to @CurrencyField

Method Summary
`double` | `getExchangeRate(String sourceCurrencyCode, String targetCurrencyCode)` Get the exchange rate betwen 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 betwen the two given currencies

  Parameters:
    `sourceCurrencyCode` -
    `targetCurrencyCode` -
  Returns:
    the exhange rate as a double
  Throws:
    `exception` - if the rate is not defined in the provider
    `SolrException`

### 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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD