task1/solution06/src/org/apidesign/apifest08/currency/Convertor.java
author japod@localhost
Sun, 28 Sep 2008 14:12:38 +0200
changeset 6 97662396c0fd
child 21 61e4c4c120fd
permissions -rw-r--r--
Adding solutions received for task1
     1 package org.apidesign.apifest08.currency;
     2 
     3 import java.math.BigDecimal;
     4 import java.util.Currency;
     5 
     6 public abstract class Convertor {
     7     
     8    /**
     9     * Converts an amount to another amount according to a given currency.
    10     *  
    11 	* @param from a source 
    12 	* @param toCurrency a target currency
    13 	* @return a converted amount
    14 	* @throws ConversionException if the conversion fails
    15 	* @throws UnsupportedConversionException if the conversion between a given currencies is not supported.
    16 	*/
    17 	public abstract Amount convert(Amount from, Currency toCurrency) throws ConversionException, UnsupportedConversionException;
    18 	
    19 	/**
    20 	 * Converts an amount value between two currencies.
    21 	 *  
    22 	 * @param amount an amount
    23 	 * @param fromCurrency an amount currency
    24 	 * @param toCurrency to a target currency
    25 	 * @return a converted amount value
    26 	 * 
    27 	 * @throws ConversionException if the conversion fails
    28 	 * @throws UnsupportedConversionException if the conversion between a given currencies is not supported.
    29 	 */
    30 	public abstract Amount convert(BigDecimal amount, Currency fromCurrency, Currency toCurrency) throws ConversionException, UnsupportedConversionException;
    31 
    32 }