task1/solution06/src/org/apidesign/apifest08/currency/Convertor.java
changeset 6 97662396c0fd
child 21 61e4c4c120fd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
     1.3 @@ -0,0 +1,32 @@
     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 +public abstract class Convertor {
    1.10 +    
    1.11 +   /**
    1.12 +    * Converts an amount to another amount according to a given currency.
    1.13 +    *  
    1.14 +	* @param from a source 
    1.15 +	* @param toCurrency a target currency
    1.16 +	* @return a converted amount
    1.17 +	* @throws ConversionException if the conversion fails
    1.18 +	* @throws UnsupportedConversionException if the conversion between a given currencies is not supported.
    1.19 +	*/
    1.20 +	public abstract Amount convert(Amount from, Currency toCurrency) throws ConversionException, UnsupportedConversionException;
    1.21 +	
    1.22 +	/**
    1.23 +	 * Converts an amount value between two currencies.
    1.24 +	 *  
    1.25 +	 * @param amount an amount
    1.26 +	 * @param fromCurrency an amount currency
    1.27 +	 * @param toCurrency to a target currency
    1.28 +	 * @return a converted amount value
    1.29 +	 * 
    1.30 +	 * @throws ConversionException if the conversion fails
    1.31 +	 * @throws UnsupportedConversionException if the conversion between a given currencies is not supported.
    1.32 +	 */
    1.33 +	public abstract Amount convert(BigDecimal amount, Currency fromCurrency, Currency toCurrency) throws ConversionException, UnsupportedConversionException;
    1.34 +
    1.35 +}