What Java type to use to represent a currency value in a web service? -
I am creating a web service in Java that will be consumed by external applications, probably written in C # . In my purchase bean, I have the currency object for the total cost. However, it leads to the following error:
by reason: com.sun.xml.bind.v2.runtime Illegal annotation exception: 1 invalid invalidation of errors, exception is not with java.util.Currency -arg default constructor
I have to create a custom XML adapter to handle currency marching / anamarselling:
Public Class Expands CurrencyAdapter XmlAdapter & lt; String, currency & gt; {Public currency unprotected (string value) throws exceptions {return Currency.getInstance (val); } Public string martial (currency val) throws exception {return val.toString ()); }}
Can I use that custom XML adapter, or can I use the BigDial (or other type) object to represent the cost?
You have a currency (which is a designated unit) and a cost (which is some quantity in that unit) Co-ordinate. You can not represent the currency in the form of BigInterge, because the currency is not a quantity.
Comments
Post a Comment