1.1 --- a/task2/solution04/src/org/apidesign/apifest08/currency/Convertor.java Wed Oct 01 10:43:05 2008 +0200
1.2 +++ b/task2/solution04/src/org/apidesign/apifest08/currency/Convertor.java Tue Oct 07 00:21:03 2008 +0200
1.3 @@ -3,6 +3,7 @@
1.4
1.5 import java.math.BigDecimal;
1.6 import java.util.Currency;
1.7 +import java.util.Set;
1.8
1.9
1.10 /**
1.11 @@ -27,4 +28,32 @@
1.12 Currency to,
1.13 BigDecimal amount)
1.14 throws InvalidConversionException;
1.15 +
1.16 + /**
1.17 + * Check to see if converting between the two currencies is possible.
1.18 + *
1.19 + * @param from the currency to convert from.
1.20 + * @param to the currency to convert to.
1.21 + * @return true if the conversion is possible.
1.22 + */
1.23 + boolean canConvert(Currency from, Currency to);
1.24 +
1.25 + /**
1.26 + * Get the currencies that the convertor supports. Just because a currency is
1.27 + * supported does not mean that canConvert will return true.
1.28 + *
1.29 + * @return the supported currencies.
1.30 + */
1.31 + Set<Currency> getCurrencies();
1.32 +
1.33 + /**
1.34 + * Get the conversion rate between two currencies.
1.35 + *
1.36 + * @param from the currency to convert from.
1.37 + * @param to the currency to convert to.
1.38 + * @return the conversion rate between the two currencies.
1.39 + * @throws InvalidConversionException if canConvert would return false.
1.40 + */
1.41 + BigDecimal getConversionRate(final Currency from, final Currency to)
1.42 + throws InvalidConversionException;
1.43 }