|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.solr.schema.OpenExchangeRatesOrgProvider
public class OpenExchangeRatesOrgProvider
Exchange Rates Provider for CurrencyField implementing the freely available
exchange rates from openexchangerates.org
| Field Summary | |
|---|---|
protected static String |
DEFAULT_RATES_FILE_LOCATION
|
protected static String |
DEFAULT_REFRESH_INTERVAL
|
static org.slf4j.Logger |
log
|
protected static String |
PARAM_RATES_FILE_LOCATION
|
protected static String |
PARAM_REFRESH_INTERVAL
|
protected org.apache.solr.schema.OpenExchangeRatesOrgProvider.OpenExchangeRates |
rates
|
protected String |
ratesFileLocation
|
protected int |
refreshInterval
|
protected ResourceLoader |
resourceLoader
|
| Constructor Summary | |
|---|---|
OpenExchangeRatesOrgProvider()
|
|
| Method Summary | |
|---|---|
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()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static org.slf4j.Logger log
protected static final String PARAM_RATES_FILE_LOCATION
protected static final String PARAM_REFRESH_INTERVAL
protected static final String DEFAULT_RATES_FILE_LOCATION
protected static final String DEFAULT_REFRESH_INTERVAL
protected String ratesFileLocation
protected int refreshInterval
protected ResourceLoader resourceLoader
protected org.apache.solr.schema.OpenExchangeRatesOrgProvider.OpenExchangeRates rates
| Constructor Detail |
|---|
public OpenExchangeRatesOrgProvider()
| Method Detail |
|---|
public double getExchangeRate(String sourceCurrencyCode,
String targetCurrencyCode)
getExchangeRate in interface ExchangeRateProvidersourceCurrencyCode - The source currency being converted from.targetCurrencyCode - The target currency being converted to.
SolrException - if the requested currency pair cannot be foundpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic Set<String> listAvailableCurrencies()
ExchangeRateProvider
listAvailableCurrencies in interface ExchangeRateProvider
public boolean reload()
throws SolrException
ExchangeRateProvider
reload in interface ExchangeRateProviderSolrException - if there is a problem reloading
public void init(Map<String,String> params)
throws SolrException
ExchangeRateProviderImportant: Custom config params must be removed from the map before returning
init in interface ExchangeRateProviderparams - a @Map of key/value config params to initialize the provider
SolrException
public void inform(ResourceLoader loader)
throws SolrException
ExchangeRateProviderTypically called after init
inform in interface ExchangeRateProviderloader - a @ResourceLoader instance
SolrException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||