< prev index next >

src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAccessorType.java

Print this page




  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 whether fields or Javabean properties are serialized by default. </p>
  38  *
  39  * <p> <b> Usage </b> </p>
  40  *
  41  * <p> <tt>@XmlAccessorType</tt> annotation can be used with the following program elements:</p>
  42  *
  43  * <ul>
  44  *   <li> package</li>
  45  *   <li> a top level class </li>
  46  * </ul>
  47  *
  48  * <p> See "Package Specification" in javax.xml.bind.package javadoc for
  49  * additional common information.</p>
  50  *
  51  * <p>This annotation provides control over the default serialization
  52  * of properties and fields in a class.
  53  *
  54  * <p>The annotation <tt> @XmlAccessorType </tt> on a package applies to
  55  * all classes in the package. The following inheritance
  56  * semantics apply:
  57  *
  58  * <ul>
  59  *   <li> If there is a <tt>@XmlAccessorType</tt> on a class, then it
  60  *        is used. </li>
  61  *   <li> Otherwise, if a <tt>@XmlAccessorType</tt> exists on one of
  62  *        its super classes, then it is inherited.
  63  *   <li> Otherwise, the <tt>@XmlAccessorType </tt> on a package is
  64  *        inherited.
  65  * </ul>
  66  * <p> <b> Defaulting Rules: </b> </p>
  67  *
  68  * <p>By default, if <tt>@XmlAccessorType </tt> on a package is absent,
  69  * then the following package level annotation is assumed.</p>
  70  * <pre>
  71  *   @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
  72  * </pre>
  73  * <p> By default, if <tt>@XmlAccessorType</tt> on a class is absent,
  74  * and none of its super classes is annotated with
  75  * <tt>@XmlAccessorType</tt>, then the following default on the class
  76  * is assumed: </p>
  77  * <pre>
  78  *   @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
  79  * </pre>
  80  * <p>This annotation can be used with the following annotations:
  81  *    {@link XmlType}, {@link XmlRootElement}, {@link XmlAccessorOrder},
  82  *    {@link XmlSchema}, {@link XmlSchemaType}, {@link XmlSchemaTypes},
  83  *    , {@link XmlJavaTypeAdapter}. It can also be used with the
  84  *    following annotations at the package level: {@link XmlJavaTypeAdapter}.
  85  *
  86  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  87  * @since 1.6, JAXB 2.0
  88  * @see XmlAccessType
  89  */
  90 
  91 @Inherited @Retention(RUNTIME) @Target({PACKAGE, TYPE})
  92 public @interface XmlAccessorType {
  93 
  94     /**
  95      * Specifies whether fields or properties are serialized.


  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 whether fields or Javabean properties are serialized by default. </p>
  38  *
  39  * <p> <b> Usage </b> </p>
  40  *
  41  * <p> {@code @XmlAccessorType} annotation can be used with the following program elements:</p>
  42  *
  43  * <ul>
  44  *   <li> package</li>
  45  *   <li> a top level class </li>
  46  * </ul>
  47  *
  48  * <p> See "Package Specification" in javax.xml.bind.package javadoc for
  49  * additional common information.</p>
  50  *
  51  * <p>This annotation provides control over the default serialization
  52  * of properties and fields in a class.
  53  *
  54  * <p>The annotation {@code @XmlAccessorType} on a package applies to
  55  * all classes in the package. The following inheritance
  56  * semantics apply:
  57  *
  58  * <ul>
  59  *   <li> If there is a {@code @XmlAccessorType} on a class, then it
  60  *        is used. </li>
  61  *   <li> Otherwise, if a {@code @XmlAccessorType} exists on one of
  62  *        its super classes, then it is inherited.
  63  *   <li> Otherwise, the {@code @XmlAccessorType} on a package is
  64  *        inherited.
  65  * </ul>
  66  * <p> <b> Defaulting Rules: </b> </p>
  67  *
  68  * <p>By default, if {@code @XmlAccessorType} on a package is absent,
  69  * then the following package level annotation is assumed.</p>
  70  * <pre>
  71  *   @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
  72  * </pre>
  73  * <p> By default, if {@code @XmlAccessorType} on a class is absent,
  74  * and none of its super classes is annotated with
  75  * {@code @XmlAccessorType}, then the following default on the class
  76  * is assumed: </p>
  77  * <pre>
  78  *   @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
  79  * </pre>
  80  * <p>This annotation can be used with the following annotations:
  81  *    {@link XmlType}, {@link XmlRootElement}, {@link XmlAccessorOrder},
  82  *    {@link XmlSchema}, {@link XmlSchemaType}, {@link XmlSchemaTypes},
  83  *    , {@link XmlJavaTypeAdapter}. It can also be used with the
  84  *    following annotations at the package level: {@link XmlJavaTypeAdapter}.
  85  *
  86  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
  87  * @since 1.6, JAXB 2.0
  88  * @see XmlAccessType
  89  */
  90 
  91 @Inherited @Retention(RUNTIME) @Target({PACKAGE, TYPE})
  92 public @interface XmlAccessorType {
  93 
  94     /**
  95      * Specifies whether fields or properties are serialized.
< prev index next >