001package org.javamoney.moneta;
002
003import javax.money.convert.ExchangeRateProviderSupplier;
004
005/**
006 * <p>
007 * This enum contains all implementation of moneta. Using this enum will easier
008 * to choose an available implementation.
009 * </p>
010 * <code>ExchangeRateProvider provider = MonetaryConversions.getExchangeRateProvider(ExchangeRateType.ECB);<code>
011 *
012 * @author otaviojava
013 */
014public enum ExchangeRateType implements ExchangeRateProviderSupplier {
015    /**
016     * Exchange rate to the European Central Bank. Uses the
017     * {@link org.javamoney.moneta.internal.convert.ECBCurrentRateProvider} implementation.
018     */
019    ECB("ECB", "Exchange rate to the European Central Bank."),
020    /**
021     * Exchange rate to the International Monetary Fond. Uses the
022     * {@link org.javamoney.moneta.internal.convert.IMFRateProvider} implementation.
023     */
024    IMF("IMF", "Exchange rate to the International Monetary Fond."),
025    /**
026     * Exchange rate to European Central Bank (last 90 days). Uses the
027     * {@link org.javamoney.moneta.internal.convert.ECBHistoric90RateProvider} implementation.
028     */
029    ECB_HIST90("ECB-HIST90",
030            "Exchange rate to European Central Bank (last 90 days)."),
031    /**
032     * Uses the {@link org.javamoney.moneta.internal.convert.ECBHistoricRateProvider} implementation.
033     */
034    ECB_HIST(
035            "ECB-HIST",
036            "Exchange rate to the European Central Bank that loads all data up to 1999 into its historic data cache."),
037    /**
038     * Uses the {@link org.javamoney.moneta.internal.convert.IdentityRateProvider} implementation.
039     */
040    IDENTITY(
041            "IDENT",
042            "Exchange rate rate with factor one for identical base/term currencies");
043
044    private final String type;
045
046    private final String description;
047
048    ExchangeRateType(String type, String description) {
049        this.type = type;
050        this.description = description;
051    }
052
053    @Override
054    public String get() {
055        return type;
056    }
057
058    public String getDescription() {
059        return description;
060    }
061
062}