author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Wed, 01 Oct 2008 10:43:05 +0200 | |
changeset 29 | f6073056b9fe |
parent 17 | task1/solution04/src/org/apidesign/apifest08/currency/InvalidConversionException.java@37c9921c653e |
child 35 | 8898c620fe96 |
permissions | -rw-r--r-- |
japod@17 | 1 |
package org.apidesign.apifest08.currency; |
japod@17 | 2 |
|
japod@17 | 3 |
|
japod@17 | 4 |
import java.util.Currency; |
japod@17 | 5 |
|
japod@17 | 6 |
|
japod@17 | 7 |
/** |
japod@17 | 8 |
* Thrown when a currency is invalid for a given Convertor. |
japod@17 | 9 |
* |
japod@17 | 10 |
* @author D'Arcy Smith |
japod@17 | 11 |
* @version 1.0 |
japod@17 | 12 |
*/ |
japod@17 | 13 |
public class InvalidConversionException |
japod@17 | 14 |
extends Exception |
japod@17 | 15 |
{ |
japod@17 | 16 |
/** |
japod@17 | 17 |
* The currency that was tried. |
japod@17 | 18 |
*/ |
japod@17 | 19 |
private final Currency badCurrency; |
japod@17 | 20 |
|
japod@17 | 21 |
/** |
japod@17 | 22 |
* A currency that is valid for the Convertor. |
japod@17 | 23 |
*/ |
japod@17 | 24 |
private final Currency currencyA; |
japod@17 | 25 |
|
japod@17 | 26 |
/** |
japod@17 | 27 |
* A currency that is valid for the Convertor. |
japod@17 | 28 |
*/ |
japod@17 | 29 |
private final Currency currencyB; |
japod@17 | 30 |
|
japod@17 | 31 |
/** |
japod@17 | 32 |
* Construct a new InvalidConversionException wit the specified message. |
japod@17 | 33 |
* |
japod@17 | 34 |
* @param msg the message for getMessage. |
japod@17 | 35 |
* @param bad the currency that is not valid. |
japod@17 | 36 |
* @param a a valid currency. |
japod@17 | 37 |
* @param b a valid currency. |
japod@17 | 38 |
*/ |
japod@17 | 39 |
public InvalidConversionException(final String msg, |
japod@17 | 40 |
final Currency bad, |
japod@17 | 41 |
final Currency a, |
japod@17 | 42 |
final Currency b) |
japod@17 | 43 |
{ |
japod@17 | 44 |
super(msg); |
japod@17 | 45 |
|
japod@17 | 46 |
badCurrency = bad; |
japod@17 | 47 |
currencyA = a; |
japod@17 | 48 |
currencyB = b; |
japod@17 | 49 |
} |
japod@17 | 50 |
|
japod@17 | 51 |
/** |
japod@17 | 52 |
* Get the currency that is not valid. |
japod@17 | 53 |
* |
japod@17 | 54 |
* @return the badCurrency |
japod@17 | 55 |
*/ |
japod@17 | 56 |
public Currency getBadCurrency() |
japod@17 | 57 |
{ |
japod@17 | 58 |
return (badCurrency); |
japod@17 | 59 |
} |
japod@17 | 60 |
|
japod@17 | 61 |
/** |
japod@17 | 62 |
* Get a currency that is valid. |
japod@17 | 63 |
* |
japod@17 | 64 |
* @return the currencyA passed to the constructor. |
japod@17 | 65 |
*/ |
japod@17 | 66 |
public Currency getCurrencyA() |
japod@17 | 67 |
{ |
japod@17 | 68 |
return (currencyA); |
japod@17 | 69 |
} |
japod@17 | 70 |
|
japod@17 | 71 |
/** |
japod@17 | 72 |
* Get a currency that is valid. |
japod@17 | 73 |
* |
japod@17 | 74 |
* @return the currencyB passed to the constructor. |
japod@17 | 75 |
*/ |
japod@17 | 76 |
public Currency getCurrencyB() |
japod@17 | 77 |
{ |
japod@17 | 78 |
return (currencyB); |
japod@17 | 79 |
} |
japod@17 | 80 |
|
japod@17 | 81 |
|
japod@17 | 82 |
} |