task2/solution01/src/org/apidesign/apifest08/currency/Convertor.java
changeset 29 f6073056b9fe
parent 6 97662396c0fd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/task2/solution01/src/org/apidesign/apifest08/currency/Convertor.java	Wed Oct 01 10:43:05 2008 +0200
     1.3 @@ -0,0 +1,51 @@
     1.4 +package org.apidesign.apifest08.currency;
     1.5 +
     1.6 +import java.math.BigDecimal;
     1.7 +import java.util.Currency;
     1.8 +
     1.9 +/** This is the skeleton class for your API. You need to make it public, so
    1.10 + * it is accessible to your client code (currently in Task1Test.java) file.
    1.11 + * <p>
    1.12 + * Feel free to create additional classes or rename this one, just keep all
    1.13 + * the API and its implementation in this package. Do not spread it outside
    1.14 + * to other packages.
    1.15 + */
    1.16 +public interface Convertor {
    1.17 +    /**
    1.18 +     * Methods converts some pounds
    1.19 +     * API design question - what kind of parameters?
    1.20 +     * I decided to use BigDecimal based on experience on Java conf ;-)
    1.21 +     * @param amountOfMoney
    1.22 +     * @return converted amount of money
    1.23 +     * @throws org.apidesign.apifest08.currency.CannotConvertException - if convertor is outdated or any other problem
    1.24 +     */
    1.25 +
    1.26 +    BigDecimal convertCurrency1ToCurrency2(BigDecimal amountOfMoney) throws CannotConvertException;
    1.27 +
    1.28 +    /**
    1.29 +     * Methods converts some pounds
    1.30 +     * API design question - what kind of parameters?
    1.31 +     * @param amountOfMoney
    1.32 +     * @return converted amount of money
    1.33 +     * @throws org.apidesign.apifest08.currency.CannotConvertException - if convertor is outdated or any other problem
    1.34 +     */
    1.35 +
    1.36 +    BigDecimal convertCurrency2ToCurrency1(BigDecimal amountOfMoney) throws CannotConvertException;
    1.37 +
    1.38 +    //handy getters
    1.39 +
    1.40 +    /**
    1.41 +     * Getter - Returns Currency 1 of this convertor
    1.42 +     * @return money code
    1.43 +     */
    1.44 +    Currency getCurrency1();
    1.45 +
    1.46 +    /**
    1.47 +     * Getter - Returns Currency 2 of this convertor
    1.48 +     * @return money code
    1.49 +     */
    1.50 +    Currency getCurrency2();
    1.51 +
    1.52 +    // For Future purposes...? - it was not as a requirement in TestCase
    1.53 +    //BigDecimal getConversionValue();
    1.54 +}