01 /*
02 * SPDX-License-Identifier: Apache-2.0
03 *
04 * Copyright 2008-2017 the original author or authors.
05 *
06 * Licensed under the Apache License, Version 2.0 (the "License");
07 * you may not use this file except in compliance with the License.
08 * You may obtain a copy of the License at
09 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package griffon.transform;
19
20 import java.lang.annotation.ElementType;
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 import java.lang.annotation.Target;
24
25 /**
26 * Annotates a groovy property or a class to support JavaFX properties.
27 * <p>
28 * When annotating a property it indicates that the property should be a
29 * bound property according to JavaFX beans, announcing to listeners
30 * that the value has changed. <br/><br/>
31 * <p>
32 * When annotating a class it indicates that all groovy properties in that
33 * class should be bound as though each property had the annotation (even
34 * if it already has it explicitly).<br/><br/>
35 * <p>
36 * It is a compilation error to place this annotation on a field (that is
37 * not a property, i.e. has scope visibility modifiers).<br/><br/>
38 * <p>
39 * If a property with a user defined setter method is annotated the code
40 * block is wrapped with the needed code to fire off the event.<br/><br/>
41 *
42 * @author Andres Almiray
43 */
44 @java.lang.annotation.Documented
45 @Retention(RetentionPolicy.SOURCE)
46 @Target({ElementType.FIELD, ElementType.TYPE})
47 public @interface FXObservable {
48 Strategy value() default Strategy.PLAIN;
49
50 enum Strategy {
51 PLAIN,
52 SHADOW_FIELD,
53 PROPERTY_ACCESOR
54 }
55 }
|