task2/solution01/src/org/apidesign/apifest08/currency/Convertor.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 01 Oct 2008 10:43:05 +0200
changeset 29 f6073056b9fe
parent 6 task1/solution01/src/org/apidesign/apifest08/currency/Convertor.java@97662396c0fd
permissions -rw-r--r--
Getting ready for task2: copying all solutions to new locations
     1 package org.apidesign.apifest08.currency;
     2 
     3 import java.math.BigDecimal;
     4 import java.util.Currency;
     5 
     6 /** This is the skeleton class for your API. You need to make it public, so
     7  * it is accessible to your client code (currently in Task1Test.java) file.
     8  * <p>
     9  * Feel free to create additional classes or rename this one, just keep all
    10  * the API and its implementation in this package. Do not spread it outside
    11  * to other packages.
    12  */
    13 public interface Convertor {
    14     /**
    15      * Methods converts some pounds
    16      * API design question - what kind of parameters?
    17      * I decided to use BigDecimal based on experience on Java conf ;-)
    18      * @param amountOfMoney
    19      * @return converted amount of money
    20      * @throws org.apidesign.apifest08.currency.CannotConvertException - if convertor is outdated or any other problem
    21      */
    22 
    23     BigDecimal convertCurrency1ToCurrency2(BigDecimal amountOfMoney) throws CannotConvertException;
    24 
    25     /**
    26      * Methods converts some pounds
    27      * API design question - what kind of parameters?
    28      * @param amountOfMoney
    29      * @return converted amount of money
    30      * @throws org.apidesign.apifest08.currency.CannotConvertException - if convertor is outdated or any other problem
    31      */
    32 
    33     BigDecimal convertCurrency2ToCurrency1(BigDecimal amountOfMoney) throws CannotConvertException;
    34 
    35     //handy getters
    36 
    37     /**
    38      * Getter - Returns Currency 1 of this convertor
    39      * @return money code
    40      */
    41     Currency getCurrency1();
    42 
    43     /**
    44      * Getter - Returns Currency 2 of this convertor
    45      * @return money code
    46      */
    47     Currency getCurrency2();
    48 
    49     // For Future purposes...? - it was not as a requirement in TestCase
    50     //BigDecimal getConversionValue();
    51 }