Annotation Interface XmlIDREF
Maps a JavaBean property to XML IDREF.
To preserve referential integrity of an object graph across XML
serialization followed by an XML deserialization, requires an object
reference to be marshaled by reference or containment
appropriately. Annotations @XmlID and @XmlIDREF
together allow a customized mapping of a JavaBean property's
type by containment or reference.
Usage
The@XmlIDREF annotation can be used with the following
program elements:
- a JavaBean property
- non-static, non transient field
See "Package Specification" in jakarta.xml.bind.package javadoc for additional common information.
The usage is subject to the following constraints:
- If the type of the field or property is a collection type,
then the collection item type must contain a property or
field annotated with
@XmlID. - If the field or property is single valued, then the type of
the property or field must contain a property or field
annotated with
@XmlID.Note: If the collection item type or the type of the property (for non collection type) is java.lang.Object, then the instance must contain a property/field annotated with
@XmlIDattribute. - This annotation can be used with the following annotations:
XmlElement,XmlAttribute,XmlList, andXmlElements.
Example: Map a JavaBean property to xs:IDREF
(i.e. by reference rather than by containment)
Example 2: The following is a complete example of containment versus reference.
Example 3: Mapping List to repeating element of type IDREF
Example 4: Mapping a List to a list of elements of type IDREF.
- Since:
- 1.6, JAXB 2.0
- Author:
- Sekhar Vajjhala, Sun Microsystems, Inc.
- See Also: