Package org.javamoney.moneta.convert.ecb
Class ECBCurrentRateProvider
- java.lang.Object
-
- org.javamoney.moneta.spi.AbstractRateProvider
-
- org.javamoney.moneta.convert.ecb.ECBCurrentRateProvider
-
- All Implemented Interfaces:
ExchangeRateProvider,LoaderService.LoaderListener
public class ECBCurrentRateProvider extends AbstractRateProvider
This class implements anExchangeRateProviderthat loads data from the European Central Bank data feed (XML). It loads the current exchange rates. The provider loads all data up to 1999 into its historic data cache.- Author:
- Anatole Tresch, Werner Keil, otaviojava
-
-
Field Summary
Fields Modifier and Type Field Description static CurrencyUnitBASE_CURRENCYBase currency of the loaded rates is always EUR.protected CountDownLatchloadLockprotected StringloadStateprotected Map<LocalDate,Map<String,ExchangeRate>>ratesHistoric exchange rates, rate timestamp as UTC long.-
Fields inherited from class org.javamoney.moneta.spi.AbstractRateProvider
log
-
-
Constructor Summary
Constructors Constructor Description ECBCurrentRateProvider()
-
Method Summary
Modifier and Type Method Description StringgetDataId()ExchangeRategetExchangeRate(ConversionQuery conversionQuery)voidnewDataLoaded(String resourceId, InputStream is)StringtoString()-
Methods inherited from class org.javamoney.moneta.spi.AbstractRateProvider
divide, divide, getContext, getCurrencyConversion, getExchangeContext, getQueryDates, getScale, multiply
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.money.convert.ExchangeRateProvider
getCurrencyConversion, getCurrencyConversion, getExchangeRate, getExchangeRate, getReversed, isAvailable, isAvailable, isAvailable
-
-
-
-
Field Detail
-
BASE_CURRENCY
public static final CurrencyUnit BASE_CURRENCY
Base currency of the loaded rates is always EUR.
-
rates
protected final Map<LocalDate,Map<String,ExchangeRate>> rates
Historic exchange rates, rate timestamp as UTC long.
-
loadState
protected volatile String loadState
-
loadLock
protected volatile CountDownLatch loadLock
-
-
Constructor Detail
-
ECBCurrentRateProvider
public ECBCurrentRateProvider()
-
-
Method Detail
-
newDataLoaded
public void newDataLoaded(String resourceId, InputStream is)
- Specified by:
newDataLoadedin interfaceLoaderService.LoaderListener
-
getExchangeRate
public ExchangeRate getExchangeRate(ConversionQuery conversionQuery)
- Specified by:
getExchangeRatein interfaceExchangeRateProvider- Specified by:
getExchangeRatein classAbstractRateProvider
-
-