001/*
002  Copyright (c) 2012, 2015, Credit Suisse (Anatole Tresch), Werner Keil and others by the @author tag.
003
004  Licensed under the Apache License, Version 2.0 (the "License"); you may not
005  use this file except in compliance with the License. You may obtain a copy of
006  the License at
007
008  http://www.apache.org/licenses/LICENSE-2.0
009
010  Unless required by applicable law or agreed to in writing, software
011  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013  License for the specific language governing permissions and limitations under
014  the License.
015 */
016package org.javamoney.moneta.convert;
017
018import javax.money.convert.ExchangeRateProviderSupplier;
019
020/**
021 * <p>
022 * This enum contains all implementations by Moneta. Using this enum will easier
023 * to choose an available implementation.
024 * </p>
025 * <code>ExchangeRateProvider provider = MonetaryConversions.getExchangeRateProvider(ExchangeRateType.ECB);<code>
026 * @author otaviojava
027 * @author Werner Keil
028 * @since 1.0.1
029 */
030public enum ExchangeRateType implements ExchangeRateProviderSupplier {
031    /**
032     * Exchange rate to the European Central Bank. Uses the
033     * {@code ECBCurrentRateProvider} implementation.
034     */
035    ECB("ECB", "Exchange rate to the European Central Bank."),
036    /**
037     * Exchange rate to the International Monetary Fund. Uses the
038     * {@code IMFRateProvider} implementation.
039     */
040    IMF("IMF", "Exchange rate to the International Monetary Fund."),
041    /**
042     * Exchange rate to the International Monetary Fund from historic. Uses the
043     * {@code IMFHistoricRateProvider} implementation.
044     */
045    IMF_HIST("IMF-HIST", "Exchange rate to the International Monetary Fund that retrieve historical information on lazy way."),
046    /**
047     * Exchange rate to European Central Bank (last 90 days). Uses the
048     * {@code ECBHistoric90RateProvider} implementation.
049     */
050    ECB_HIST90("ECB-HIST90",
051            "Exchange rate to European Central Bank (last 90 days)."),
052    /**
053     * Uses the {@code ECBHistoricRateProvider} implementation.
054     */
055    ECB_HIST(
056            "ECB-HIST",
057            "Exchange rate to the European Central Bank that loads all data up to 1999 into its historic data cache."),
058    /**
059     * Uses the {@link IdentityRateProvider} implementation.
060     */
061    IDENTITY(
062            "IDENT",
063            "Exchange rate rate with factor one for identical base/term currencies");
064
065    private final String type;
066
067    private final String description;
068
069    ExchangeRateType(String type, String description) {
070        this.type = type;
071        this.description = description;
072    }
073
074    @Override
075    public String get() {
076        return type;
077    }
078
079    public String getDescription() {
080        return description;
081    }
082}