japod@6
|
1 |
package org.apidesign.apifest08.currency;
|
japod@6
|
2 |
|
japod@6
|
3 |
import java.math.BigDecimal;
|
japod@6
|
4 |
import java.util.Currency;
|
japod@6
|
5 |
|
japod@6
|
6 |
public abstract class Convertor {
|
japod@6
|
7 |
|
japod@6
|
8 |
/**
|
japod@6
|
9 |
* Converts an amount to another amount according to a given currency.
|
japod@6
|
10 |
*
|
japod@6
|
11 |
* @param from a source
|
japod@6
|
12 |
* @param toCurrency a target currency
|
japod@6
|
13 |
* @return a converted amount
|
japod@6
|
14 |
* @throws ConversionException if the conversion fails
|
japod@6
|
15 |
* @throws UnsupportedConversionException if the conversion between a given currencies is not supported.
|
japod@6
|
16 |
*/
|
japod@6
|
17 |
public abstract Amount convert(Amount from, Currency toCurrency) throws ConversionException, UnsupportedConversionException;
|
japod@6
|
18 |
|
japod@6
|
19 |
/**
|
japod@6
|
20 |
* Converts an amount value between two currencies.
|
japod@6
|
21 |
*
|
japod@6
|
22 |
* @param amount an amount
|
japod@6
|
23 |
* @param fromCurrency an amount currency
|
japod@6
|
24 |
* @param toCurrency to a target currency
|
japod@6
|
25 |
* @return a converted amount value
|
japod@6
|
26 |
*
|
japod@6
|
27 |
* @throws ConversionException if the conversion fails
|
japod@6
|
28 |
* @throws UnsupportedConversionException if the conversion between a given currencies is not supported.
|
japod@6
|
29 |
*/
|
japod@6
|
30 |
public abstract Amount convert(BigDecimal amount, Currency fromCurrency, Currency toCurrency) throws ConversionException, UnsupportedConversionException;
|
japod@6
|
31 |
|
japod@6
|
32 |
}
|