Hi I am able to crate java class using jaxb xjc with java.util.List.
How to create the same class with java.util.Set ? I like create the java class as follows.
protected Set<ActivitiesByType> activitiesByType;
public Set<ActivitiesByType> getActivitiesByType() {
if (activitiesByType == null) {
activitiesByType = new HashSet<ActivitiesByType>();
}
return this.activitiesByType;
}
XSD
<xs:element name="todaysActivities">
<xs:complexType>
<xs:sequence>
<xs:element ref="activitiesByType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="digitalAsset">
Java Classes
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"activitiesByType"
})
@XmlRootElement(name = "todaysActivities")
public class TodaysActivities {
@XmlElement(required = true)
protected List<ActivitiesByType> activitiesByType;
public List<ActivitiesByType> getActivitiesByType() {
if (activitiesByType == null) {
activitiesByType = new ArrayList<ActivitiesByType>();
}
return this.activitiesByType;
}
}