@AnnotationHandlerFor(value=FXObservable.class) public class FXObservableASTTransformation extends AbstractASTTransformation implements AnnotationHandler
@FXObservable
Generally, it adds (if needed) a javafx.beans.property.Property type
It also generates the setter and getter and wires the them through the javafx.beans.property.Property.
COLLECTIONS_CLASS, GRIFFON_APPLICATION_TYPE, INJECT_TYPE, NAMED_TYPE
Constructor and Description |
---|
FXObservableASTTransformation() |
Modifier and Type | Method and Description |
---|---|
protected void |
createGetterMethod(org.codehaus.groovy.ast.ClassNode declaringClass,
org.codehaus.groovy.ast.PropertyNode propertyNode,
String getterName,
org.codehaus.groovy.ast.stmt.Statement getterBlock,
List<org.codehaus.groovy.ast.AnnotationNode> annotations)
Creates a getter method and adds it to the declaring class.
|
protected org.codehaus.groovy.ast.stmt.Statement |
createGetterStatement(org.codehaus.groovy.ast.PropertyNode fxProperty)
Creates the body of a getter method for the original property that is actually backed by a
JavaFX *Property instance:
|
protected void |
createSetterMethod(org.codehaus.groovy.ast.ClassNode declaringClass,
org.codehaus.groovy.ast.PropertyNode propertyNode,
String setterName,
org.codehaus.groovy.ast.stmt.Statement setterBlock,
List<org.codehaus.groovy.ast.AnnotationNode> annotations)
Creates a setter method and adds it to the declaring class.
|
protected org.codehaus.groovy.ast.stmt.Statement |
createSetterStatement(org.codehaus.groovy.ast.PropertyNode fxProperty)
Creates the body of a setter method for the original property that is actually backed by a
JavaFX *Property instance:
|
static boolean |
hasFXObservableAnnotation(org.codehaus.groovy.ast.AnnotatedNode node)
Convenience method to see if an annotated node is
@FXObservable . |
void |
visit(org.codehaus.groovy.ast.ASTNode[] nodes,
org.codehaus.groovy.control.SourceUnit sourceUnit)
This ASTTransformation method is called when the compiler encounters our annotation.
|
addDelegateMethods, addError, applicationExpression, applicationProperty, checkNodesForAnnotationAndType, emptyMap, injectApplication, injectedField, injectedField, makeClassSafe, makeClassSafe, makeClassSafe, makeClassSafe0, makeClassSafeWithGenerics, makeClassSafeWithGenerics, makeClassSafeWithGenerics, makeGenericsType, makeGenericsType, makeGenericsType, memberHasValue, needsDelegate, newClass
public static boolean hasFXObservableAnnotation(org.codehaus.groovy.ast.AnnotatedNode node)
@FXObservable
.node
- the node to checkpublic void visit(org.codehaus.groovy.ast.ASTNode[] nodes, org.codehaus.groovy.control.SourceUnit sourceUnit)
visit
in interface org.codehaus.groovy.transform.ASTTransformation
nodes
- An array of nodes. Index 0 is the annotation that triggered the call, index 1
is the annotated node.sourceUnit
- The SourceUnit describing the source code in which the annotation was placed.protected void createSetterMethod(org.codehaus.groovy.ast.ClassNode declaringClass, org.codehaus.groovy.ast.PropertyNode propertyNode, String setterName, org.codehaus.groovy.ast.stmt.Statement setterBlock, List<org.codehaus.groovy.ast.AnnotationNode> annotations)
void
declaringClass
- The class to which the method is addedpropertyNode
- The property node being accessed by this settersetterName
- The name of the setter methodsetterBlock
- The code body of the methodprotected void createGetterMethod(org.codehaus.groovy.ast.ClassNode declaringClass, org.codehaus.groovy.ast.PropertyNode propertyNode, String getterName, org.codehaus.groovy.ast.stmt.Statement getterBlock, List<org.codehaus.groovy.ast.AnnotationNode> annotations)
declaringClass
- The class to which the method is addedpropertyNode
- The property node being accessed by this gettergetterName
- The name of the getter methodgetterBlock
- The code body of the methodprotected org.codehaus.groovy.ast.stmt.Statement createSetterStatement(org.codehaus.groovy.ast.PropertyNode fxProperty)
Object $property = this.someProperty() $property.setValue(value)
fxProperty
- The original Groovy property that we're creating a setter for.protected org.codehaus.groovy.ast.stmt.Statement createGetterStatement(org.codehaus.groovy.ast.PropertyNode fxProperty)
Object $property = this.someProperty() return $property.getValue()
fxProperty
- The new JavaFX property.