38 |
|
|
39 |
package java.util; |
package java.util; |
40 |
|
|
41 |
import gnu.java.locale.LocaleInformation; |
import gnu.java.locale.LocaleHelper; |
42 |
|
|
43 |
import java.io.IOException; |
import java.io.IOException; |
44 |
import java.io.ObjectStreamException; |
import java.io.ObjectStreamException; |
93 |
* @serial the number of fraction digits |
* @serial the number of fraction digits |
94 |
*/ |
*/ |
95 |
private transient int fractionDigits; |
private transient int fractionDigits; |
|
|
|
|
/** |
|
|
* The currency symbol used when formatting currency strings. |
|
|
* When this field is <code>null</code> the <code>currencyCode</code> |
|
|
* has to be used instead. |
|
|
* |
|
|
* @see #getSymbol() |
|
|
* @see #getSymbol(java.util.Locale) |
|
|
* @serial the currency symbol, or <code>null</code> |
|
|
*/ |
|
|
private transient String currencySymbol; |
|
96 |
|
|
97 |
/** |
/** |
98 |
* A cached map of country codes |
* A cached map of country codes |
196 |
} |
} |
197 |
/* Retrieve the fraction digits */ |
/* Retrieve the fraction digits */ |
198 |
fractionDigits = Integer.parseInt(properties.getProperty(fractionDigitsKey)); |
fractionDigits = Integer.parseInt(properties.getProperty(fractionDigitsKey)); |
|
/* Get currency symbol */ |
|
|
currencySymbol = |
|
|
(String) LocaleInformation.getCurrencySymbols().get(currencyCode); |
|
199 |
} |
} |
200 |
|
|
201 |
/** |
/** |
346 |
|
|
347 |
/** |
/** |
348 |
* This method returns the symbol which precedes or follows a |
* This method returns the symbol which precedes or follows a |
349 |
* value in this particular currency. In cases where there is no |
* value in this particular currency in the default locale. |
350 |
* such symbol for the currency, the ISO 4217 currency |
* In cases where there is no such symbol for the currency, |
351 |
* code is returned. |
* the ISO 4217 currency code is returned. |
352 |
* |
* |
353 |
* @return the currency symbol, or the ISO 4217 currency code if |
* @return the currency symbol, or the ISO 4217 currency code if |
354 |
* one doesn't exist. |
* one doesn't exist. |
355 |
*/ |
*/ |
356 |
public String getSymbol() |
public String getSymbol() |
357 |
{ |
{ |
358 |
return currencySymbol == null ? getCurrencyCode() : currencySymbol; |
return getSymbol(Locale.getDefault()); |
359 |
} |
} |
360 |
|
|
361 |
/** |
/** |
385 |
*/ |
*/ |
386 |
public String getSymbol(Locale locale) |
public String getSymbol(Locale locale) |
387 |
{ |
{ |
388 |
/* |
return LocaleHelper.getLocalizedString(locale, currencyCode, |
389 |
We don't currently have the currency symbols, so we always |
"currenciesSymbol", false, true); |
|
return the currency code. |
|
|
*/ |
|
|
return getCurrencyCode(); |
|
390 |
} |
} |
391 |
|
|
392 |
/** |
/** |