public class FileExchangeRateProvider extends Object implements ExchangeRateProvider
Modifier and Type | Field and Description |
---|---|
protected static String |
PARAM_CURRENCY_CONFIG |
Constructor and Description |
---|
FileExchangeRateProvider() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
double |
getExchangeRate(String sourceCurrencyCode,
String targetCurrencyCode)
Returns the currently known exchange rate between two currencies.
|
int |
hashCode() |
void |
inform(ResourceLoader loader)
Passes a ResourceLoader, used to read config files from e.g.
|
void |
init(Map<String,String> params)
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.
|
String |
toString() |
protected static final String PARAM_CURRENCY_CONFIG
public double getExchangeRate(String sourceCurrencyCode, String targetCurrencyCode)
getExchangeRate
in interface ExchangeRateProvider
sourceCurrencyCode
- The source currency being converted from.targetCurrencyCode
- The target currency being converted to.SolrException
- if the requested currency pair cannot be foundpublic Set<String> listAvailableCurrencies()
ExchangeRateProvider
listAvailableCurrencies
in interface ExchangeRateProvider
public boolean reload() throws SolrException
ExchangeRateProvider
reload
in interface ExchangeRateProvider
SolrException
- if there is a problem reloadingpublic void init(Map<String,String> params) throws SolrException
ExchangeRateProvider
Important: Custom config params must be removed from the map before returning
init
in interface ExchangeRateProvider
params
- a @Map of key/value config params to initialize the providerSolrException
public void inform(ResourceLoader loader) throws SolrException
ExchangeRateProvider
Typically called after init
inform
in interface ExchangeRateProvider
loader
- a @ResourceLoader instanceSolrException
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.