public class PropertyListenerASTTransformation extends AbstractASTTransformation
@PropertyListener
annotation.
Any closures found as the annotation's value will be either transformed
into inner classes that implement PropertyChangeListener (when the value
is a closure defined in place) or be casted as a proxy of PropertyChangeListener
(when the value is a property reference found in the same class).List of closures are also supported.
COLLECTIONS_CLASS, GRIFFON_APPLICATION_TYPE, INJECT_TYPE, NAMED_TYPE
Constructor and Description |
---|
PropertyListenerASTTransformation() |
Modifier and Type | Method and Description |
---|---|
static void |
addListenerToClass(org.codehaus.groovy.control.SourceUnit source,
org.codehaus.groovy.ast.AnnotationNode annotation,
org.codehaus.groovy.ast.ClassNode classNode) |
static void |
addListenerToProperty(org.codehaus.groovy.control.SourceUnit source,
org.codehaus.groovy.ast.AnnotationNode annotation,
org.codehaus.groovy.ast.ClassNode declaringClass,
org.codehaus.groovy.ast.FieldNode field) |
static boolean |
hasListenerAnnotation(org.codehaus.groovy.ast.AnnotatedNode node)
Convenience method to see if an annotated node is
@PropertyListener . |
void |
visit(org.codehaus.groovy.ast.ASTNode[] nodes,
org.codehaus.groovy.control.SourceUnit source)
Handles the bulk of the processing, mostly delegating to other methods.
|
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 hasListenerAnnotation(org.codehaus.groovy.ast.AnnotatedNode node)
@PropertyListener
.node
- the node to checkpublic static void addListenerToProperty(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.AnnotationNode annotation, org.codehaus.groovy.ast.ClassNode declaringClass, org.codehaus.groovy.ast.FieldNode field)
public static void addListenerToClass(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.AnnotationNode annotation, org.codehaus.groovy.ast.ClassNode classNode)
public void visit(org.codehaus.groovy.ast.ASTNode[] nodes, org.codehaus.groovy.control.SourceUnit source)
nodes
- the ast nodessource
- the source unit for the nodes