001/*
002 *  jDTAUS Banking SPI
003 *  Copyright (C) 2005 Christian Schulte
004 *  <cs@schulte.it>
005 *
006 *  This library is free software; you can redistribute it and/or
007 *  modify it under the terms of the GNU Lesser General Public
008 *  License as published by the Free Software Foundation; either
009 *  version 2.1 of the License, or any later version.
010 *
011 *  This library is distributed in the hope that it will be useful,
012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 *  Lesser General Public License for more details.
015 *
016 *  You should have received a copy of the GNU Lesser General Public
017 *  License along with this library; if not, write to the Free Software
018 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
019 *
020 */
021package org.jdtaus.banking.spi;
022
023import java.util.Currency;
024import java.util.Date;
025import org.jdtaus.banking.CurrencyDirectory;
026
027/**
028 * Maps {@code Currency} instances to various codes.
029 * <p>jDTAUS Banking SPI {@code CurrencyMapper} specification to be used by implementations to map {@code Currency}
030 * instances to codes and vice versa.</p>
031 *
032 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
033 * @version $JDTAUS: CurrencyMapper.java 8661 2012-09-27 11:29:58Z schulte $
034 *
035 * @see org.jdtaus.core.container.Container
036 */
037public interface CurrencyMapper extends CurrencyDirectory
038{
039
040    /**
041     * Gets the DTAUS code for a currency at a given date.
042     *
043     * @param currency The currency to return the corresponding DTAUS code for.
044     * @param date The date to return the DTAUS code for.
045     *
046     * @return The DTAUS code for {@code currency} at {@code date}.
047     *
048     * @throws NullPointerException if either {@code currency} or {@code date} is {@code null}.
049     * @throws UnsupportedCurrencyException if {@code currency} is not known to the directory at {@code date}.
050     */
051    char getDtausCode( Currency currency, Date date );
052
053    /**
054     * Gets the currency for a DTAUS code at a given date.
055     *
056     * @param code The DTAUS code to return the corresponding currency for.
057     * @param date The date to return the currency for.
058     *
059     * @return The currency corresponding to {@code code} at {@code date} or {@code null} if no currency matching
060     * {@code code} is known to the directory at {@code date}.
061     *
062     * @throws NullPointerException if {@code date} is {@code null}.
063     */
064    Currency getDtausCurrency( char code, Date date );
065
066}