@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.
| Modifier and Type | Field and Description |
|---|---|
| protected static final ClassNode |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | addListenerToProperty(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field)
|
| protected void | addPropertyChangeSupport(ClassNode
the class to which we add the support field and methods declaringClass)Adds the necessary field and methods to support property change support. |
| protected Statement | Returns: the created statementthe field node for the property propertyNode, Expression a field expression for setting the property value fieldExpression)Creates a statement body similar to:
|
| private void | |
| protected void | createSetterMethod(ClassNode
the class to which we will add the setter declaringClass, PropertyNode the field to back the setter propertyNode, String the name of the setter setterName, Statement the statement representing the setter block setterBlock)Creates a setter method with the given body. |
| public static boolean | Returns: true if the node is bindablethe node to check node)Convenience method to see if an annotated node is |
| protected boolean | Returns: true if property change support should be addedthe class to search declaringClass, SourceUnit the source unit, for error reporting. sourceUnit)@NotNull.Snoops through the declaring class and all parents looking for methods
|
| public void | visit(ASTNode[]
the ast nodes nodes, SourceUnit the source unit for the nodes source)Implements org. |
| private static void |
| boundClassNode | back to summary |
|---|---|
| protected static final ClassNode boundClassNode | |
| BindableASTTransformation | back to summary |
|---|---|
| public BindableASTTransformation() | |
| addListenerToClass | back to summary |
|---|---|
| private void addListenerToClass(SourceUnit source, ClassNode classNode) | |
| addListenerToProperty | back to summary |
|---|---|
| private void addListenerToProperty(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field) | |
| addPropertyChangeSupport | back to summary |
|---|---|
| protected void addPropertyChangeSupport(ClassNode declaringClass) Adds the necessary field and methods to support property change support. Adds a new field:
Also adds support methods:
| |
| createBindableStatement | back to summary |
|---|---|
| protected Statement createBindableStatement(PropertyNode propertyNode, Expression fieldExpression) Creates a statement body similar to:
| |
| createListenerSetter | back to summary |
|---|---|
| private void createListenerSetter(ClassNode classNode, PropertyNode propertyNode) | |
| createSetterMethod | back to summary |
|---|---|
| protected void createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) Creates a setter method with the given body.
| |
| hasBindableAnnotation | back to summary |
|---|---|
| public static boolean hasBindableAnnotation(AnnotatedNode node) Convenience method to see if an annotated node is
| |
| needsPropertyChangeSupport | back to summary |
|---|---|
| protected boolean needsPropertyChangeSupport(ClassNode declaringClass, SourceUnit sourceUnit) Snoops through the declaring class and all parents looking for methods
| |
| visit | back to summary |
|---|---|
| public void visit(ASTNode[] nodes, SourceUnit source) Implements org. Handles the bulk of the processing, mostly delegating to other methods.
| |
| wrapSetterMethod | back to summary |
|---|---|
| private static void wrapSetterMethod(ClassNode classNode, String propertyName) | |