|
Griffon 1.2.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.griffon.ast.AbstractASTTransformation
org.codehaus.griffon.ast.PropertyListenerASTTransformation
@GroovyASTTransformation(phase= CompilePhase.CANONICALIZATION) public class PropertyListenerASTTransformation extends AbstractASTTransformation
Handles generation of code for the @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 closue 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.
Field Summary | |
---|---|
private static String |
EMPTY_STRING
|
private static ClassNode |
PROPERTY_CHANGE_LISTENER_CLASS
|
private static ClassNode |
PROPERTY_LISTENER_CLASS
|
Fields inherited from class AbstractASTTransformation | |
---|---|
APPLICATION_HOLDER_TYPE, COLLECTIONS_CLASS |
Constructor Summary | |
PropertyListenerASTTransformation()
|
Method Summary | |
---|---|
private static void
|
addListenerStatement(ClassNode classNode, ArgumentListExpression args)
|
static void
|
addListenerToClass(SourceUnit source, AnnotationNode annotation, ClassNode classNode)
|
static void
|
addListenerToProperty(SourceUnit source, AnnotationNode annotation, ClassNode declaringClass, FieldNode field)
|
private static void
|
addPropertyChangeListener(ClassNode classNode, String propertyName, ClosureExpression closure)
|
private static void
|
addPropertyChangeListener(ClassNode classNode, String propertyName, VariableExpression variable)
|
static boolean
|
hasListenerAnnotation(AnnotatedNode node)
Convenience method to see if an annotated node is @PropertyListener. |
private static void
|
processExpression(ClassNode classNode, String propertyName, Expression expression)
|
void
|
visit(ASTNode[] nodes, SourceUnit source)
Handles the bulk of the processing, mostly delegating to other methods. |
Methods inherited from class AbstractASTTransformation | |
---|---|
addError, applicationInstance, checkNodesForAnnotationAndType, emptyMap, makeClassSafe, makeClassSafe, makeClassSafe, newClass |
Field Detail |
---|
private static final String EMPTY_STRING
private static final ClassNode PROPERTY_CHANGE_LISTENER_CLASS
private static final ClassNode PROPERTY_LISTENER_CLASS
Constructor Detail |
---|
PropertyListenerASTTransformation()
Method Detail |
---|
private static void addListenerStatement(ClassNode classNode, ArgumentListExpression args)
public static void addListenerToClass(SourceUnit source, AnnotationNode annotation, ClassNode classNode)
public static void addListenerToProperty(SourceUnit source, AnnotationNode annotation, ClassNode declaringClass, FieldNode field)
private static void addPropertyChangeListener(ClassNode classNode, String propertyName, ClosureExpression closure)
private static void addPropertyChangeListener(ClassNode classNode, String propertyName, VariableExpression variable)
public static boolean hasListenerAnnotation(AnnotatedNode node)
node
- the node to check
private static void processExpression(ClassNode classNode, String propertyName, Expression expression)
public void visit(ASTNode[] nodes, SourceUnit source)
nodes
- the ast nodessource
- the source unit for the nodes
Groovy Documentation