Path: blob/master/src/java.desktop/share/classes/java/beans/Transient.java
41152 views
/*1* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.beans;2627import java.lang.annotation.Retention;28import java.lang.annotation.Target;2930import static java.lang.annotation.ElementType.METHOD;31import static java.lang.annotation.RetentionPolicy.RUNTIME;3233/**34* Indicates that an attribute called "transient"35* should be declared with the given {@code value}36* when the {@link Introspector} constructs37* a {@link PropertyDescriptor} or {@link EventSetDescriptor}38* classes associated with the annotated code element.39* A {@code true} value for the "transient" attribute40* indicates to encoders derived from {@link Encoder}41* that this feature should be ignored.42* <p>43* The {@code Transient} annotation may be used44* in any of the methods that are involved45* in a {@link FeatureDescriptor} subclass46* to identify the transient feature in the annotated class and its subclasses.47* Normally, the method that starts with "get" is the best place48* to put the annotation and it is this declaration49* that takes precedence in the case of multiple annotations50* being defined for the same feature.51* <p>52* To declare a feature non-transient in a class53* whose superclass declares it transient,54* use {@code @Transient(false)}.55* In all cases, the {@link Introspector} decides56* if a feature is transient by referring to the annotation57* on the most specific superclass.58* If no {@code Transient} annotation is present59* in any superclass the feature is not transient.60*61* @since 1.762*/63@Target({METHOD})64@Retention(RUNTIME)65public @interface Transient {66/**67* Returns whether or not the {@code Introspector} should68* construct artifacts for the annotated method.69* @return whether or not the {@code Introspector} should70* construct artifacts for the annotated method71*/72boolean value() default true;73}747576