<i18n dev> Currency updates in JDK 7

Stephen Colebourne scolebourne at joda.org
Sun Aug 23 13:44:02 PDT 2009

I've been reviewing the Javadoc for the JDK 7 Currency class changes
(bug 6332666).

The updates appear to allow users the ability to override the built in
currency data, as indicated in the class javadoc:

"Users can supersede the Java runtime currency data by creating a
properties file named <JAVA_HOME>/lib/currency.properties. The
contents of the properties file are key/value pairs of the ISO 3166
country codes and the ISO 4217 currency data respectively. The value
part consists of three ISO 4217 values of a currency, i.e., an
alphabetic code, a numeric code, and a minor unit. Those three ISO
4217 values are separated by commas. The lines which start with '#'s
are considered comment lines. For example,

#Sample currency properties

will supersede the currency data for Japan. "

Unfortunately, not all currencies are associated with countries. Some,
like XAG for 'silver', XDR for 'IMF drawing rights' or XXX for 'no
currency' have no matching country. Thus, this file format is unable
to represent user overrides to those countries.

Further, the Javadoc is unclear as to whether users can _add_ new
currencies. An example would be if a country split, like Czech/Slovak,
and created two currencies. Does the new format add a currency to the
built in list if it isn't recognised?

I believe that we should also consider if Currency should implement
Comparable, sorting alphabetically on the currency code. While there
are many possible sort orders, having this as the default one makes a
lot of sense.

Finally, I'd like to see a method isPsuedoCurrency() added. This would
return a boolean indicating if the currency is 'real' or not.

Otherwise the changes pretty much complete the use cases for the class.


More information about the i18n-dev mailing list