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