task2/solution04/src/org/apidesign/apifest08/currency/Convertor.java
changeset 29 f6073056b9fe
parent 17 37c9921c653e
child 35 8898c620fe96
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/task2/solution04/src/org/apidesign/apifest08/currency/Convertor.java	Wed Oct 01 10:43:05 2008 +0200
     1.3 @@ -0,0 +1,30 @@
     1.4 +package org.apidesign.apifest08.currency;
     1.5 +
     1.6 +
     1.7 +import java.math.BigDecimal;
     1.8 +import java.util.Currency;
     1.9 +
    1.10 +
    1.11 +/**
    1.12 + * Convert between two currencies.
    1.13 + *
    1.14 + * @author D'Arcy Smith
    1.15 + * @version 1.0
    1.16 + */
    1.17 +public interface Convertor
    1.18 +{
    1.19 +    /**
    1.20 +     * Convert an amount from one currency to another.
    1.21 +     * 
    1.22 +     * @param from the currency to convert from.
    1.23 +     * @param to the currency to convert to.
    1.24 +     * @param amount the amount to convert.
    1.25 +     * @return the converted amount.
    1.26 +     * @throws IllegalArgumentException if any of the arguments are null.
    1.27 +     * @throws InvalidConversionException if either from or to are not valid for the convertor.
    1.28 +     */
    1.29 +    BigDecimal convert(Currency   from, 
    1.30 +                       Currency   to, 
    1.31 +                       BigDecimal amount)
    1.32 +        throws InvalidConversionException;
    1.33 +}