Top Description Methods
org.eclipse.persistence.oxm.annotations

public @Interface XmlKey

extends Annotation
Annotations
@Target:METHOD, FIELD
@Retention:RUNTIME
Static Imports
java.lang.annotation.ElementType.FIELD, .ElementType.METHOD, .RetentionPolicy.RUNTIME

XmlKey is used to mark a property as a key, to be referenced using a key-based mapping via XmlJoinNode. This is similar to the XmlID annotation, but doesn't require the property be bound to the schema type ID. XmlKey is typically used in the composite key use case, since only 1 property can be annotated with the XmlID annotation.

Example:

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Employee {

    @XmlKey
    public String id;

    @XmlKey
    public String department;

    @XmlJoinNodes({
        @XmlJoinNode(xmlPath="manager/id/text()", referencedXmlPath="id/text()"),
        @XmlJoinNode(xmlPath="manager/dept/text()", referencedXmlPath="department/text()")
    })
    public Employee manager;
}
See Also
XmlJoinNode, XmlJoinNodes

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString