【发布时间】:2010-10-27 04:48:04
【问题描述】:
给定这样的架构:
<xs:element name="Group" type="GroupType"/>
<xs:complexType name="GroupType">
<xs:sequence>
<xs:element type="OptionsType" name="Options" maxOccurs="1" minOccurs="1"/>
<xs:element type="PageContainerType" name="PageContainer" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PageContainerType">
<xs:sequence>
...
</xs:sequence>
</xs:complexType>
XJC 将生成类似以下的 Java:
public class GroupType {
@XmlElement(name = "Options", required = true)
protected OptionsType options;
@XmlElement(name = "PageContainer")
protected List<PageContainerType> pageContainer;
...
}
我想为 PageContainer 元素强制使用唯一的集合。这是一个逆向工程项目,所以我不太关心确保架构明确执行它。
是否可以通过在架构或 XJC 绑定中指定某些内容来将 PageContainer 元素生成为 Set<PageContainerType>?
【问题讨论】: