Currency updates in JDK 7
Alan Bateman
Alan.Bateman at Sun.COM
Sun Aug 23 07:43:21 UTC 2009
Stephen Colebourne wrote:
> I've been reviewing the Javadoc for the JDK 7 Currency class changes.
> http://download.java.net/jdk7/docs/api/java/util/Currency.html
>
> 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
> JP=JPZ,999,0
>
> 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.
>
> Stephen
>
Stephen - the Currency class (and a few others in java.util, such as
Locale, Calendar, ...) are maintained by the i18n group. I don't know if
the folks in that group are on this mailing list so you might be better
re-sending to i18n-dev. If it helps, the bugID used to separate the
currency data from rt.jar, and allow it be superseded , was 6332666.
-Alan.
More information about the core-libs-dev
mailing list