199 |
} |
} |
200 |
|
|
201 |
/** |
/** |
202 |
|
* Constructor for the "XXX" special case. This allows |
203 |
|
* a Currency to be constructed from an assumed good |
204 |
|
* currency code. |
205 |
|
* |
206 |
|
* @param code the code to use. |
207 |
|
*/ |
208 |
|
private Currency(String code) |
209 |
|
{ |
210 |
|
currencyCode = code; |
211 |
|
fractionDigits = -1; /* Pseudo currency */ |
212 |
|
} |
213 |
|
|
214 |
|
/** |
215 |
* Returns the ISO4217 currency code of this currency. |
* Returns the ISO4217 currency code of this currency. |
216 |
* |
* |
217 |
* @return a <code>String</code> containing currency code. |
* @return a <code>String</code> containing currency code. |
316 |
|
|
317 |
/* |
/* |
318 |
* Throw a null pointer exception explicitly if currencyCode is null. |
* Throw a null pointer exception explicitly if currencyCode is null. |
319 |
* One is not thrown otherwise. It results in an IllegalArgumentException. |
* One is not thrown otherwise. It results in an |
320 |
|
* IllegalArgumentException. |
321 |
*/ |
*/ |
322 |
if (currencyCode == null) |
if (currencyCode == null) |
323 |
{ |
{ |
324 |
throw new NullPointerException("The supplied currency code is null."); |
throw new NullPointerException("The supplied currency code is null."); |
325 |
} |
} |
326 |
|
/* Nasty special case to allow an erroneous currency... blame Sun */ |
327 |
|
if (currencyCode.equals("XXX")) |
328 |
|
return new Currency("XXX"); |
329 |
Currency newCurrency = (Currency) cache.get(currencyCode); |
Currency newCurrency = (Currency) cache.get(currencyCode); |
330 |
if (newCurrency == null) |
if (newCurrency == null) |
331 |
{ |
{ |