Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use java.util.Currency in GWT?

Tags:

java

currency

gwt

I'm working on a GWT application, and we introduced a Money class that contains a java.util.Currency. The only problem is that GWT doesn't seem to support this class.

I did a google search and found this code in the GWT source code, but I'm not quite sure what the "jat numberformat-r2942" library is, or how to inherit it into my project. Has anybody successfully been able to use this GWT library? If not, what is the best way to deal with currencies in a GWT application?

Should I just capture the currency as a String on the client side, then create a Currency object on the server side? We're trying to use the GWT-dispatch library, so I'd like to use the same bean on the client and server side.

like image 206
Javid Jamae Avatar asked Dec 17 '25 04:12

Javid Jamae


1 Answers

You can use <super-source> to replace all non-translatable classes with your version.

Take a look at http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html, look for "Overriding one package implementation with another".

OTOH, if you only need to transfer this object through GWT-RPC, then use the new RequestFactory that solves this issue altogether - there are no common classes on server and client, proxies are used instead.

like image 72
Peter Knego Avatar answered Dec 19 '25 20:12

Peter Knego