1 package org.apidesign.apifest08.currency;
3 import java.math.BigDecimal;
4 import java.util.Currency;
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.
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
13 public interface Convertor {
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
23 BigDecimal convertCurrency1ToCurrency2(BigDecimal amountOfMoney) throws CannotConvertException;
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
33 BigDecimal convertCurrency2ToCurrency1(BigDecimal amountOfMoney) throws CannotConvertException;
38 * Getter - Returns Currency 1 of this convertor
41 Currency getCurrency1();
44 * Getter - Returns Currency 2 of this convertor
47 Currency getCurrency2();
49 // For Future purposes...? - it was not as a requirement in TestCase
50 //BigDecimal getConversionValue();