This content has been marked as final.
Show 2 replies
-
1. Re: Multi Currency Tips
Mark Varley Dec 11, 2008 3:22 PM (in response to Mark Varley)I'm not sure if this is the best way to go but I have added a static hashmap of exchange rates to my MonetaryAmount class which is populated daily by my XRateAction class (gets latest rates from Yahoo). The MonetaryAmount class has methods for convert(MonetaryAmount, Currency), add(MonetaryAmount), subtract(MonetaryAmount), equals(Object) and compareTo(MonetaryAmount) which make use of this hashmap to reflect the value of the amount in the user's preferred currency (stored on the User object).
mark
-
2. Re: Multi Currency Tips
Alexander Schwartz Dec 31, 2008 11:40 AM (in response to Mark Varley)This reply is a bit late :)
I would design it that there is MonetaryAmount on all products, and a preferred currency for the users.
I would do the conversion separate from both, in a (JSF)-Converter.
Alexander.