|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.beans.BindableASTTransformation
@GroovyASTTransformation(phase= CompilePhase.CANONICALIZATION) public class BindableASTTransformation extends java.lang.Object
Handles generation of code for the @Bindable annotation when @Vetoable is not present.
Generally, it adds (if needed) a PropertyChangeSupport field and the needed add/removePropertyChangeListener methods to support the listeners. It also generates the setter and wires the setter through the PropertyChangeSupport. If a Vetoable annotation is detected it does nothing and lets the VetoableASTTransformation handle all the changes.Field Summary | |
---|---|
protected static ClassNode |
boundClassNode
|
protected ClassNode |
pcsClassNode
|
Method Summary | |
---|---|
protected void
|
addPropertyChangeSupport(ClassNode declaringClass)
Adds the necessary field and methods to support property change support. |
protected Statement
|
createBindableStatement(PropertyNode propertyNode, Expression fieldExpression)
|
protected void
|
createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, java.lang.String setterName, Statement setterBlock)
Creates a setter method with the given body. |
static boolean
|
hasBindableAnnotation(AnnotatedNode node)
Convenience method to see if an annotated node is @Bindable. |
protected boolean
|
needsPropertyChangeSupport(ClassNode declaringClass, SourceUnit sourceUnit)
|
void
|
visit(ASTNode[] nodes, SourceUnit source)
Handles the bulk of the processing, mostly delegating to other methods. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected static ClassNode boundClassNode
protected ClassNode pcsClassNode
Method Detail |
---|
protected void addPropertyChangeSupport(ClassNode declaringClass)
protected final java.beans.PropertyChangeSupport this$PropertyChangeSupport = new java.beans.PropertyChangeSupport(this)
"
Also adds support methods:
public void addPropertyChangeListener(java.beans.PropertyChangeListener)
public void addPropertyChangeListener(String, java.beans.PropertyChangeListener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(String, java.beans.PropertyChangeListener)
public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
declaringClass
- the class to which we add the support field and methods
protected Statement createBindableStatement(PropertyNode propertyNode, Expression fieldExpression)
protected void createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, java.lang.String setterName, Statement setterBlock)
declaringClass
- the class to which we will add the setterpropertyNode
- the field to back the settersetterName
- the name of the settersetterBlock
- the statement representing the setter block
public static boolean hasBindableAnnotation(AnnotatedNode node)
node
- the node to check
protected boolean needsPropertyChangeSupport(ClassNode declaringClass, SourceUnit sourceUnit)
public void visit(ASTNode[] nodes, SourceUnit source)
nodes
- the ast nodessource
- the source unit for the nodes
Groovy Documentation