1 /*
   2  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.xml.bind.annotation;
  27 
  28 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  29 import java.lang.annotation.Target;
  30 import java.lang.annotation.Retention;
  31 import java.lang.annotation.Inherited;
  32 
  33 import static java.lang.annotation.ElementType.*;
  34 import static java.lang.annotation.RetentionPolicy.*;
  35 
  36 /**
  37  * <p> Controls the ordering of fields and properties in a class. </p>
  38  *
  39  * <h3>Usage </h3>
  40  *
  41  * <p> <tt> @XmlAccessorOrder </tt> annotation can be used with the following
  42  * program elements:</p>
  43  *
  44  * <ul>
  45  *   <li> package</li>
  46  *   <li> a top level class </li>
  47  * </ul>
  48  *
  49  * <p> See "Package Specification" in <tt>javax.xml.bind</tt> package javadoc for
  50  * additional common information.</p>
  51  *
  52  * <p>The effective {@link XmlAccessOrder} on a class is determined
  53  * as follows:
  54  *
  55  * <ul>
  56  *   <li> If there is a <tt>@XmlAccessorOrder</tt> on a class, then
  57  *        it is used. </li>
  58  *   <li> Otherwise, if a <tt>@XmlAccessorOrder </tt> exists on one of
  59  *        its super classes, then it is inherited (by the virtue of
  60  *        {@link Inherited})
  61  *   <li> Otherwise, the <tt>@XmlAccessorOrder</tt> on the package
  62  *        of the class is used, if it's there.
  63  *   <li> Otherwise {@link XmlAccessOrder#UNDEFINED}.
  64  * </ul>
  65  *
  66  * <p>This annotation can be used with the following annotations:
  67  *    {@link XmlType}, {@link XmlRootElement}, {@link XmlAccessorType},
  68  *    {@link XmlSchema}, {@link XmlSchemaType}, {@link XmlSchemaTypes},
  69  *    , {@link XmlJavaTypeAdapter}. It can also be used with the
  70  *    following annotations at the package level: {@link XmlJavaTypeAdapter}.
  71  *
  72  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  73  * @since JAXB2.0
  74  * @see XmlAccessOrder
  75  */
  76 
  77 @Inherited @Retention(RUNTIME) @Target({PACKAGE, TYPE})
  78 public @interface XmlAccessorOrder {
  79         XmlAccessOrder value() default XmlAccessOrder.UNDEFINED;
  80 }