View Javadoc

1   /*
2    *  jDTAUS Banking SPI
3    *  Copyright (C) 2005 Christian Schulte
4    *  <cs@schulte.it>
5    *
6    *  This library is free software; you can redistribute it and/or
7    *  modify it under the terms of the GNU Lesser General Public
8    *  License as published by the Free Software Foundation; either
9    *  version 2.1 of the License, or any later version.
10   *
11   *  This library is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   *  Lesser General Public License for more details.
15   *
16   *  You should have received a copy of the GNU Lesser General Public
17   *  License along with this library; if not, write to the Free Software
18   *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19   *
20   */
21  package org.jdtaus.banking.spi;
22  
23  import java.util.Currency;
24  import java.util.Date;
25  import org.jdtaus.banking.CurrencyDirectory;
26  
27  /**
28   * Maps {@code Currency} instances to various codes.
29   * <p>jDTAUS Banking SPI {@code CurrencyMapper} specification to be used by implementations to map {@code Currency}
30   * instances to codes and vice versa.</p>
31   *
32   * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
33   * @version $JDTAUS: CurrencyMapper.java 8661 2012-09-27 11:29:58Z schulte $
34   *
35   * @see org.jdtaus.core.container.Container
36   */
37  public interface CurrencyMapper extends CurrencyDirectory
38  {
39  
40      /**
41       * Gets the DTAUS code for a currency at a given date.
42       *
43       * @param currency The currency to return the corresponding DTAUS code for.
44       * @param date The date to return the DTAUS code for.
45       *
46       * @return The DTAUS code for {@code currency} at {@code date}.
47       *
48       * @throws NullPointerException if either {@code currency} or {@code date} is {@code null}.
49       * @throws UnsupportedCurrencyException if {@code currency} is not known to the directory at {@code date}.
50       */
51      char getDtausCode( Currency currency, Date date );
52  
53      /**
54       * Gets the currency for a DTAUS code at a given date.
55       *
56       * @param code The DTAUS code to return the corresponding currency for.
57       * @param date The date to return the currency for.
58       *
59       * @return The currency corresponding to {@code code} at {@code date} or {@code null} if no currency matching
60       * {@code code} is known to the directory at {@code date}.
61       *
62       * @throws NullPointerException if {@code date} is {@code null}.
63       */
64      Currency getDtausCurrency( char code, Date date );
65  
66  }