Plugin should not generate List-properties if maxOccurs defaults to 1
For the simplify-plugin, all examples in the reference have choice-elements with maxOccurs="unbounded", which correctly results in List-properties. But if maxOccurs is not specified it defaults to 1, so there should not be List-properties but singular fields.
Example:
<xs:complexType name="typeWithElementsProperty">
<xs:choice> <!-- maxOccurs defaults to 1! -->
<xs:element name="foo" type="xs:string"/>
<xs:element name="bar" type="xs:int"/>
</xs:choice>
</xs:complexType>
should rather result in
@XmlElement(name = "foo", type = String.class)
protected String foo; // no List!
@XmlElement(name = "bar", type = Integer.class)
protected Integer bar; // no List!
for usage of <simplify:as-element-property/>
I'm not sure if this is the correct place to post the question but kind of looks similar to what i need. The behaviour the @ashauer needs is what i get from the default jaxb2-maven plugin.
So by not targeting the elements in my bindings.xjb file using <simplify:as-element-property/> jaxb2-maven plugin generates elements as a single object IF <xs:choice> is used and maxOccurs is 1.
But what i'm wondering is if it's possible to "override" the maxOccurs value in the child elements and if there's element with maxOccurs="1", then will be generated as a single object?
So, i still want to use <xs:choice maxOccurs="unbounded">so that i can add more elements inside of that complexType, but not all the elements should be generated as a List<T>.
(Using example from above :)
<xs:complexType name="typeWithElementsProperty">
<xs:choice maxOccurs="unbounded">
<xs:element name="foo" type="xs:string"/>
<xs:element name="bar" type="xs:int" maxOccurs="1"/>
</xs:choice>
</xs:complexType>
Would result in
@XmlElement(name = "foo", type = String.class)
protected List<String> foo; // List!
@XmlElement(name = "bar", type = Integer.class)
protected Integer bar; // no List!