35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package java.util; |
package java.util; |
40 |
|
|
41 |
|
import gnu.java.locale.LocaleInformation; |
42 |
|
|
43 |
import java.io.IOException; |
import java.io.IOException; |
44 |
import java.io.ObjectStreamException; |
import java.io.ObjectStreamException; |
45 |
import java.io.Serializable; |
import java.io.Serializable; |
53 |
* a constructor. |
* a constructor. |
54 |
* |
* |
55 |
* @see java.util.Locale |
* @see java.util.Locale |
56 |
* @author Guilhem Lavaux <guilhem.lavaux@free.fr> |
* @author Guilhem Lavaux (guilhem.lavaux@free.fr) |
57 |
* @author Dalibor Topic <robilad@kaffe.org> |
* @author Dalibor Topic (robilad@kaffe.org) |
58 |
* @author Bryce McKinlay <mckinlay@redhat.com> |
* @author Bryce McKinlay (mckinlay@redhat.com) |
59 |
* @author Andrew John Hughes <gnu_andrew@member.fsf.org> |
* @author Andrew John Hughes (gnu_andrew@member.fsf.org) |
60 |
* @since 1.4 |
* @since 1.4 |
61 |
*/ |
*/ |
62 |
public final class Currency |
public final class Currency |
96 |
private transient int fractionDigits; |
private transient int fractionDigits; |
97 |
|
|
98 |
/** |
/** |
99 |
|
* The currency symbol used when formatting currency strings. |
100 |
|
* When this field is <code>null</code> the <code>currencyCode</code> |
101 |
|
* has to be used instead. |
102 |
|
* |
103 |
|
* @see #getSymbol() |
104 |
|
* @see #getSymbol(java.util.Locale) |
105 |
|
* @serial the currency symbol, or <code>null</code> |
106 |
|
*/ |
107 |
|
private transient String currencySymbol; |
108 |
|
|
109 |
|
/** |
110 |
* A cache of <code>Currency</code> instances to |
* A cache of <code>Currency</code> instances to |
111 |
* ensure the singleton nature of this class. The key |
* ensure the singleton nature of this class. The key |
112 |
* is the locale of the currency. |
* is the locale of the currency. |
190 |
} |
} |
191 |
/* Retrieve the fraction digits */ |
/* Retrieve the fraction digits */ |
192 |
fractionDigits = Integer.parseInt(properties.getProperty(fractionDigitsKey)); |
fractionDigits = Integer.parseInt(properties.getProperty(fractionDigitsKey)); |
193 |
|
/* Get currency symbol */ |
194 |
|
currencySymbol = |
195 |
|
(String) LocaleInformation.getCurrencySymbols().get(currencyCode); |
196 |
} |
} |
197 |
|
|
198 |
/** |
/** |
324 |
*/ |
*/ |
325 |
public String getSymbol() |
public String getSymbol() |
326 |
{ |
{ |
327 |
/* |
return currencySymbol == null ? getCurrencyCode() : currencySymbol; |
|
We don't currently have the currency symbols, so we always |
|
|
return the currency code. |
|
|
*/ |
|
|
return getCurrencyCode(); |
|
328 |
} |
} |
329 |
|
|
330 |
/** |
/** |