我正在尝试使用我现有的 POJO 类中的 jaxb 生成模式,直到现在它工作正常,现在我有一个要求,我需要声明一个属性类型是我的 XSD,但属性值应该是预定义值之一。下面是我班上的代码快照
private String destinationID;
private String contactNo;
private String type;
@XmlAttribute
private String name;
我的要求是 name 应该包含任何预定义的值一个类似于这个的模式
<xsd:attribute name="type"
type="simpleType.Generic.ProductReferenceType" use="required" />
<xsd:simpleType name="simpleType.Generic.ProductReferenceType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="OFFER" />
<xsd:enumeration value="SELLER" />
<xsd:enumeration value="DEFINITION" />
</xsd:restriction>
</xsd:simpleType>
我无法找出我需要在课堂上做什么才能实现这种情况
提前致谢