There’s a new DataType called CurrencyDataType, and corresponding CurrencyValue. A CurrencyValue consists of a fixed-point decimal number and one of the ISO 4217 currencies. For example, you can say
CurrencyValue newValue = CurrencyValue.create( 12, 34, CurrencyDataType.USD ); System.out.println( newValue );
which will, by default, print:
It correctly handles currencies that have 0, 1, or 3 digits after the decimal point, too.
In a JSP page, you can say, as you would expect:
<mesh:property meshObjectName="Subject" propertyType="org.infogrid.model.Test/AllProperties_OptionalCurrencyDataType" />
(or the identifier of a PropertyType in your model that is of type CurrencyDataType) which will print
12.34 USD in view mode, and automatically make it editable in edit mode.
Isn’t it much easier if your data platform does this, than having to write currency parsing and rendering code all over one’s application?