0N/A/*
2362N/A * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.xml.bind.annotation;
0N/A
0N/Aimport java.lang.annotation.Target;
0N/Aimport java.lang.annotation.Retention;
0N/Aimport static java.lang.annotation.ElementType.*;
0N/Aimport static java.lang.annotation.RetentionPolicy.*;
0N/A
0N/A/**
0N/A * <p>
0N/A * Maps a JavaBean property to XML ID.
0N/A *
0N/A * <p>
0N/A * To preserve referential integrity of an object graph across XML
0N/A * serialization followed by a XML deserialization, requires an object
0N/A * reference to be marshalled by reference or containment
0N/A * appropriately. Annotations <tt>&#64;XmlID</tt> and <tt>&#64;XmlIDREF</tt>
0N/A * together allow a customized mapping of a JavaBean property's
0N/A * type by containment or reference.
0N/A *
0N/A * <p><b>Usage</b> </p>
0N/A * The <tt>&#64;XmlID</tt> annotation can be used with the following
0N/A * program elements:
0N/A * <ul>
0N/A * <li> a JavaBean property </li>
0N/A * <li> non static, non transient field </li>
0N/A * </ul>
0N/A *
0N/A * <p>See "Package Specification" in javax.xml.bind.package javadoc for
0N/A * additional common information.</p>
0N/A *
0N/A * The usage is subject to the following constraints:
0N/A * <ul>
0N/A * <li> At most one field or property in a class can be annotated
0N/A * with <tt>&#64;XmlID</tt>. </li>
0N/A * <li> The JavaBean property's type must be <tt>java.lang.String</tt>.</li>
0N/A * <li> The only other mapping annotations that can be used
0N/A * with <tt>&#64;XmlID</tt>
0N/A * are:<tt>&#64;XmlElement</tt> and <tt>&#64;XmlAttribute</tt>.</li>
0N/A * </ul>
0N/A *
0N/A * <p><b>Example</b>: Map a JavaBean property's type to <tt>xs:ID</tt></p>
0N/A * <pre>
0N/A * // Example: code fragment
0N/A * public class Customer {
0N/A * &#64;XmlAttribute
0N/A * &#64;XmlID
0N/A * public String getCustomerID();
0N/A * public void setCustomerID(String id);
0N/A * .... other properties not shown
0N/A * }
0N/A *
0N/A * &lt;!-- Example: XML Schema fragment -->
0N/A * &lt;xs:complexType name="Customer">
0N/A * &lt;xs:complexContent>
0N/A * &lt;xs:sequence>
0N/A * ....
0N/A * &lt;/xs:sequence>
0N/A * &lt;xs:attribute name="customerID" type="xs:ID"/>
0N/A * &lt;/xs:complexContent>
0N/A * &lt;/xs:complexType>
0N/A * </pre>
0N/A *
0N/A * @author Sekhar Vajjhala, Sun Microsystems, Inc.
0N/A * @see XmlIDREF
0N/A * @since JAXB2.0
0N/A */
0N/A
0N/A@Retention(RUNTIME) @Target({FIELD, METHOD})
0N/Apublic @interface XmlID { }
0N/A