When I run xjc to generate a Java type representing this XSD fragment:
<xs:complexType name="fileUploadRequest"> <xs:choice> <xs:element name="path" type="xs:string"/> <xs:element name="file" type="xs:base64Binary"/> </xs:choice> </xs:complexType>
I get a class that is indistinguishable from what would happen if I specified a sequence
with optional elements.
I need a type with a little intelligence that will allow me to have no more than 1 element of my choice at a time. If I call the generated setFile
method, for example, it should make the path null. Is there any plugin that I can use for what seems like an obvious requirement of a code generator?
source share