Annotation Type XmlIDREF
-
@Retention(RUNTIME) @Target({FIELD,METHOD}) public @interface XmlIDREFMaps 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
@XmlIDand@XmlIDREFtogether allow a customized mapping of a JavaBean property's type by containment or reference.Usage
The@XmlIDREFannotation 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
{@snippet : //EXAMPLE: Code fragment public class Shipping {xs:IDREF(i.e. by reference rather than by containment)- Since:
- 1.6, JAXB 2.0
- Author:
- Sekhar Vajjhala, Sun Microsystems, Inc.
- See Also:
XmlID