author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Wed, 01 Oct 2008 10:43:05 +0200 | |
changeset 29 | f6073056b9fe |
parent 17 | task1/solution04/src/org/apidesign/apifest08/currency/Convertor.java@37c9921c653e |
child 35 | 8898c620fe96 |
permissions | -rw-r--r-- |
japod@6 | 1 |
package org.apidesign.apifest08.currency; |
japod@6 | 2 |
|
japod@6 | 3 |
|
japod@6 | 4 |
import java.math.BigDecimal; |
japod@6 | 5 |
import java.util.Currency; |
japod@6 | 6 |
|
japod@6 | 7 |
|
japod@6 | 8 |
/** |
japod@6 | 9 |
* Convert between two currencies. |
japod@6 | 10 |
* |
japod@6 | 11 |
* @author D'Arcy Smith |
japod@6 | 12 |
* @version 1.0 |
japod@6 | 13 |
*/ |
japod@17 | 14 |
public interface Convertor |
japod@6 | 15 |
{ |
japod@6 | 16 |
/** |
japod@17 | 17 |
* Convert an amount from one currency to another. |
japod@6 | 18 |
* |
japod@17 | 19 |
* @param from the currency to convert from. |
japod@17 | 20 |
* @param to the currency to convert to. |
japod@6 | 21 |
* @param amount the amount to convert. |
japod@6 | 22 |
* @return the converted amount. |
japod@17 | 23 |
* @throws IllegalArgumentException if any of the arguments are null. |
japod@17 | 24 |
* @throws InvalidConversionException if either from or to are not valid for the convertor. |
japod@6 | 25 |
*/ |
japod@17 | 26 |
BigDecimal convert(Currency from, |
japod@17 | 27 |
Currency to, |
japod@17 | 28 |
BigDecimal amount) |
japod@17 | 29 |
throws InvalidConversionException; |
japod@6 | 30 |
} |