task1/solution02/src/org/apidesign/apifest08/currency/Convertor.java
changeset 16 2864c6d744c0
parent 6 97662396c0fd
     1.1 --- a/task1/solution02/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
     1.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/Convertor.java	Tue Sep 30 11:47:02 2008 +0200
     1.3 @@ -4,35 +4,15 @@
     1.4  
     1.5  
     1.6  /** 
     1.7 - * Converts one currency to other. The conversion is unidirectional. 
     1.8 - * For example you can have convertor that converts USD (sourceCurrency) to CZK (destination currency). You can call the {@link Convertor#convert(Money)} method
     1.9 - * with amount in USD to get the equivalent in CZK. If you need convert CZK to USD you can call {@link Convertor#revert()} method to get CZK to USD 
    1.10 - * convertor. To create a convertor instance call {@link ConvertorFactory#createConvertor(Currency, Currency)}.
    1.11 + * Converts currencies. To create an instance call {@link ConvertorFactory#createConvertor(Money, Money)}.
    1.12   */
    1.13  public interface Convertor {
    1.14  	/**
    1.15 -	 * Converts amount in source currency to amount in destination currency. The result is rounded to two decimal places.
    1.16 -	 * @param money 
    1.17 +	 * Converts amount to its equivalent in the destination currency. 
    1.18 +	 * @param amount 
    1.19 +	 * @param destinationCurrency
    1.20  	 * @return
    1.21 -	 * @throws IllegalArgumentException if money.getCurrency is not equal to sourceCurrency.
    1.22 +	 * @throws IllegalArgumentException if currency of the amount is not supported or if it is not possible to convert it to the destination currency.
    1.23  	 */
    1.24 -	public Money convert(Money money);
    1.25 -
    1.26 -	/**
    1.27 -	 * Returns convertor that converts from destination currency to source currency with the same exchange rate. 
    1.28 -	 * @return
    1.29 -	 */
    1.30 -	public Convertor revert();
    1.31 -	
    1.32 -	/**
    1.33 -	 * Returns source currency.
    1.34 -	 * @return
    1.35 -	 */
    1.36 -	public Currency getSourceCurrency();
    1.37 -
    1.38 -	/**
    1.39 -	 * Returns destination currency.
    1.40 -	 * @return
    1.41 -	 */
    1.42 -	public Currency getDestinationCurrency();
    1.43 +	public Money convert(Money amount, Currency destinationCurrency) throws IllegalArgumentException;
    1.44  }