@Retention(value=RUNTIME) @Target(value={字段,METHOD}) public @interface XmlID
将JavaBean属性映射到XML ID。
为了保持XML序列化之后的XML反序列化对象图的引用完整性,需要通过引用或遏制来对对象引用进行编组。 注释@XmlID和@XmlIDREF一起允许通过遏制或引用定制映射JavaBean属性的类型。
用法
@XmlID注释可以与以下程序元素一起使用:有关其他常见信息,请参阅javax.xml.bind.package javadoc中的“Package Specification”。
用法受以下限制:示例 :将JavaBean属性的类型映射到xs:ID
// Example: code fragment
public class Customer {
@XmlAttribute
@XmlID
public String getCustomerID();
public void setCustomerID(String id);
.... other properties not shown
}
<!-- Example: XML Schema fragment -->
<xs:complexType name="Customer">
<xs:complexContent>
<xs:sequence>
....
</xs:sequence>
<xs:attribute name="customerID" type="xs:ID"/>
</xs:complexContent>
</xs:complexType>
XmlIDREF
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.