So I want to have a list to be annotated with @XmlElements like the following
@XmlElements(
{
@XmlElement(name = "Apple", type = Apple.class),
@XmlElement(name = "Orange", type = Orange.class),
@XmlElement(name = "Mango", type = Mango.class)
}
)
public List<Fruit> getEntries() {
return fruitList;
}
I am wondering whether there is a way to enforce the list to contain at least 1 element, because right now, the xsd looks like
<xs:complexType name="fruitList">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Apple" type="tns:apple"/>
<xs:element name="Orange" type="tns:orange"/>
<xs:element name="Mango" type="tns:mango"/>
</xs:choice>
</xs:sequence>
</xs:complexType>