I need to validate the structure of an XML in input using JSR-303 annotations. So I want my XML to contain all the required tags, and I accept if the XML tags contain no value at all. So there must be all the tags and they can be empty.
The problem is that if @NotNull annotation works well for Strings (so I can have the xml tag without value in it), for Double variables I cannot use it, because if I empty the tag, it returns me the error like I delete the tag also.
For istance:
<extTag>
<myString>Hello</myString> -> @NotNull String myString; -> OK!
</extTag>
<extTag>
<myString></myString> -> @NotNull String myString; -> OK!
</extTag>
<extTag>
-> @NotNull String myString; -> ERROR!
</extTag>
For Double I would like to have the same control, but when the value is null I get the error!
<extTag>
<myDouble>12.00</myDouble> -> @NotNull Double myDouble; -> OK!
</extTag>
<extTag>
<myDouble></myDouble> -> @NotNull Double myDouble; -> ERROR!
</extTag>
<extTag>
-> @NotNull Double myDouble; -> ERROR!
</extTag>
I can I get the same behaviour od strings for Double variables using annotations?