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