Path: blob/master/src/java.desktop/share/classes/java/beans/BeanProperty.java
41152 views
/*1* Copyright (c) 2014, 2016, 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.Documented;28import java.lang.annotation.Retention;29import java.lang.annotation.Target;3031import static java.lang.annotation.ElementType.METHOD;32import static java.lang.annotation.RetentionPolicy.RUNTIME;3334/**35* An annotation used to specify some property-related information for the36* automatically generated {@link BeanInfo} classes. This annotation is not used37* if the annotated class has a corresponding user-defined {@code BeanInfo}38* class, which does not imply the automatic analysis. If both the read and the39* write methods of the property are annotated, then the read method annotation40* will have more priority and replace the write method annotation.41*42* @author Sergey A. Malenkov43* @see BeanInfo#getPropertyDescriptors44* @since 945*/46@Documented47@Target({METHOD})48@Retention(RUNTIME)49public @interface BeanProperty {50/**51* The value that indicates whether the annotated property can be52* a {@link PropertyDescriptor#isBound bound} property or not.53* This value applies only to the beans that have the54* {@link PropertyChangeListener propertyChange} event set.55*56* @return {@code true} if the annotated property can be a bound property;57* {@code false} otherwise.58*/59boolean bound() default true;6061/**62* The value that indicates whether the annotated property is63* an {@link PropertyDescriptor#isExpert expert} property or not.64*65* @return {@code true} if the annotated property is an expert property;66* {@code false} otherwise.67*/68boolean expert() default false;6970/**71* The value that indicates whether the annotated property is72* a {@link PropertyDescriptor#isHidden hidden} property or not.73*74* @return {@code true} if the annotated property is a hidden property;75* {@code false} otherwise.76*/77boolean hidden() default false;7879/**80* The value that indicates whether the annotated property is81* a {@link PropertyDescriptor#isPreferred preferred} property or not.82*83* @return {@code true} if the annotated property is a preferred property;84* {@code false} otherwise.85*/86boolean preferred() default false;8788/**89* The value that indicates whether the annotated property is90* a required property or not.91*92* @return {@code true} if the annotated property is a required property;93* {@code false} otherwise.94*/95boolean required() default false;9697/**98* The value that indicates whether the corresponding component99* is repainted after the annotated property got changed or not.100*101* @return {@code true} if the corresponding component is repainted;102* {@code false} otherwise.103*/104boolean visualUpdate() default false;105106/**107* The {@link PropertyDescriptor#getShortDescription short description}108* for the {@link BeanInfo#getPropertyDescriptors descriptor}109* of the annotated property.110*111* @return the property description,112* or an empty string if the description is not set.113*/114String description() default "";115116/**117* The array of names for the public static fields118* that contains the valid values of the annotated property.119* These names are used to generate the {@code enumerationValues}120* {@link java.beans.BeanDescriptor#getValue feature attribute}121* that must contain the following items per each property value:122* a displayable name for the property value, the actual property value,123* and a Java code piece used for the code generator.124*125* @return the names of the valid values of the annotated property,126* or an empty array if the names are not provided.127*/128String[] enumerationValues() default {};129}130131132