Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: keilw
Reporter: keilw
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

Make CurrencyUnit or adequate replacement an Interface

Created: 01/Aug/12 12:09 PM   Updated: 05/Feb/13 11:28 PM  Due: 01/Dec/12   Resolved: 01/Dec/12 08:54 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Tags: multi-curency design
Participants: keilw

 Description  « Hide

As one of the main goals of the JSR is to support Custom Currencies, the straw man draft of CurrencyUnit based on JodaMoney will not work for it.

In fact, JSR 310 showed something like a "pattern" by introducing an interface PeriodUnit, then implemented by types such as LocalPeriodUnit.

Hence, CurrencyUnit (or another name if anybody has a better one) should be an interface, and (just an example) "LocalCurrencyUnit" or similar be implementing classes. Whether or not an enum would work for some implementations is probably worth exploring.

If enums won't work, then either the getInstance(), the of() or a different factory.
Java generally has valueOf(). It seems, of() is an attempt of a shorter version.
None of the common JVM languages seem to use that, Fantom has make() as constructor and from*() especially fromString(), but no of*() either.

-> Harmonize across API, where concrete Money types have similar factory methods.

keilw added a comment - 01/Dec/12 08:54 PM

As of new repository CurrencyUnit was turned into an interface.
To be implemented by java.util.Currency in a matching version of OpenJDK or any equivalent currency type in other platforms, e.g. CLDC 8.