KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > bind > annotation > XmlAccessorType


1 /*
2  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4  */

5
6 package javax.xml.bind.annotation;
7
8 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
9 import java.lang.annotation.Target JavaDoc;
10 import java.lang.annotation.Retention JavaDoc;
11 import java.lang.annotation.Inherited JavaDoc;
12
13 import static java.lang.annotation.ElementType JavaDoc.*;
14 import static java.lang.annotation.RetentionPolicy JavaDoc.*;
15
16 /**
17  * <p> Controls whether fields or Javabean properties are serialized by default. </p>
18  *
19  * <p> <b> Usage </b> </p>
20  *
21  * <p> <tt>@XmlAccessorType</tt> annotation can be used with the following program elements:</p>
22  *
23  * <ul>
24  * <li> package</li>
25  * <li> a top level class </li>
26  * </ul>
27  *
28  * <p> See "Package Specification" in javax.xml.bind.package javadoc for
29  * additional common information.</p>
30  *
31  * <p>This annotation provides control over the default serialization
32  * of properties and fields in a class.
33  *
34  * <p>The annotation <tt> @XmlAccessorType </tt> on a package applies to
35  * all classes in the package. The following inheritance
36  * semantics apply:
37  *
38  * <ul>
39  * <li> If there is a <tt>@XmlAccessorType</tt> on a class, then it
40  * is used. </li>
41  * <li> Otherwise, if a <tt>@XmlAccessorType</tt> exists on one of
42  * its super classes, then it is inherited.
43  * <li> Otherwise, the <tt>@XmlAccessorType </tt> on a package is
44  * inherited.
45  * </ul>
46  * <p> <b> Defaulting Rules: </b> </p>
47  *
48  * <p>By default, if <tt>@XmlAccessorType </tt> on a package is absent,
49  * then the following package level annotation is assumed.</p>
50  * <pre>
51  * &#64;XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
52  * </pre>
53  * <p> By default, if <tt>@XmlAccessorType</tt> on a class is absent,
54  * and none of its super classes is annotated with
55  * <tt>@XmlAccessorType</tt>, then the following default on the class
56  * is assumed: </p>
57  * <pre>
58  * &#64;XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
59  * </pre>
60  * <p>This annotation can be used with the following annotations:
61  * {@link XmlType}, {@link XmlRootElement}, {@link XmlAccessorOrder},
62  * {@link XmlSchema}, {@link XmlSchemaType}, {@link XmlSchemaTypes},
63  * , {@link XmlJavaTypeAdapter}. It can also be used with the
64  * following annotations at the package level: {@link XmlJavaTypeAdapter}.
65  *
66  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
67  * @since JAXB2.0
68  * @see XmlAccessType
69  * @version $Revision: 1.8 $
70  */

71
72 @Inherited JavaDoc @Retention JavaDoc(RUNTIME) @Target JavaDoc({PACKAGE, TYPE})
73 public @interface XmlAccessorType {
74
75     /**
76      * Specifies whether fields or properties are serialized.
77      *
78      * @see XmlAccessType
79      */

80     XmlAccessType value() default XmlAccessType.PUBLIC_MEMBER;
81 }
82
Popular Tags