1 /*
2 * Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package java.beans;
27
28 import java.lang.annotation.Retention;
29 import java.lang.annotation.Target;
30
31 import static java.lang.annotation.ElementType.METHOD;
32 import static java.lang.annotation.RetentionPolicy.RUNTIME;
33
34 /**
35 * Indicates that an attribute called "transient"
36 * should be declared with the given {@code value}
37 * when the {@link Introspector} constructs
38 * a {@link PropertyDescriptor} or {@link EventSetDescriptor}
39 * classes associated with the annotated code element.
40 * A {@code true} value for the "transient" attribute
41 * indicates to encoders derived from {@link Encoder}
42 * that this feature should be ignored.
43 * <p/>
44 * The {@code Transient} annotation may be be used
45 * in any of the methods that are involved
46 * in a {@link FeatureDescriptor} subclass
47 * to identify the transient feature in the annotated class and its subclasses.
48 * Normally, the method that starts with "get" is the best place
49 * to put the annotation and it is this declaration
50 * that takes precedence in the case of multiple annotations
51 * being defined for the same feature.
52 * <p/>
53 * To declare a feature non-transient in a class
54 * whose superclass declares it transient,
55 * use {@code @Transient(false)}.
56 * In all cases, the {@link Introspector} decides
57 * if a feature is transient by referring to the annotation
58 * on the most specific superclass.
59 * If no {@code Transient} annotation is present
60 * in any superclass the feature is not transient.
61 *
62 * @since 1.7
63 */
64 @Target({METHOD})
65 @Retention(RUNTIME)
66 public @interface Transient {
67 boolean value() default true;
68 }