Allow deserialization of empty optional elements
Brought to you by:
niallg
I have an optional element, named sessionToken:
@Element(name="sessionToken",required=false)
private String fSessionTokenString;
When I set this field to an empty string
fSessionTokenString = "";
it will be serialized as <sessionToken></sessionToken> which is what I expect.
When I dezerialize an XML document with such an empty element, it will be ignored and fSessionTokenString is null.
In my context, no sessionToken element or an empty sessionToken element (<sessionToken></sessionToken>) makes a different. I.e. I'm not able to distinguish between this to cases.