Tuesday, 2 December 2014

JAXB How to parse empty value string to null Integer



I have the next problem. I have to define the attribute of XLS as Integer. When the XMLAdapter (define for me) receives the value, instead of receiving a null or empty, you receive a 0 (because de Integer parse emty '' value to 0), which is incorrect in my case. How do I know if this value comes from a "" or a 0? I need If the attribute value is "", the value should be Null; if 0, should be 0. For me it is a bug in JAXB. I read: JAXB: how to make JAXB NOT to unmarshal empty string to 0 But its not a solution for me. What can I do?! Thanks!


No comments:

Post a Comment