Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Modifiers | Name | Description |
---|---|---|
protected static ClassNode |
constrainedClassNode |
Fields inherited from class | Fields |
---|---|
class BindableASTTransformation |
boundClassNode |
Type | Name and description |
---|---|
protected void |
addVetoableChangeSupport(ClassNode declaringClass) Adds the necessary field and methods to support vetoable change support. |
protected Statement |
createConstrainedStatement(PropertyNode propertyNode, Expression fieldExpression) Creates a statement body similar to: this.fireVetoableChange("field", field, field = value) |
protected Statement |
createSetStatement(Expression fieldExpression) Creates a statement body similar to: field = value . |
protected void |
createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) Creates a setter method with the given body. |
static boolean |
hasVetoableAnnotation(AnnotatedNode node) Convenience method to see if an annotated node is @Vetoable . |
protected boolean |
needsVetoableChangeSupport(ClassNode declaringClass, SourceUnit sourceUnit) Snoops through the declaring class and all parents looking for a field of type VetoableChangeSupport. |
void |
visit(ASTNode[] nodes, SourceUnit source) Handles the bulk of the processing, mostly delegating to other methods. |
Methods inherited from class | Name |
---|---|
class BindableASTTransformation |
addPropertyChangeSupport, createBindableStatement, createSetterMethod, hasBindableAnnotation, needsPropertyChangeSupport, visit |
class Object |
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Adds the necessary field and methods to support vetoable change support.
Adds a new field:
"protected final java.beans.VetoableChangeSupport this$vetoableChangeSupport = new java.beans.VetoableChangeSupport(this)"
Also adds support methods:
public void addVetoableChangeListener(java.beans.VetoableChangeListener)
public void addVetoableChangeListener(String, java.beans.VetoableChangeListener)
public void removeVetoableChangeListener(java.beans.VetoableChangeListener)
public void removeVetoableChangeListener(String, java.beans.VetoableChangeListener)
public java.beans.VetoableChangeListener[] getVetoableChangeListeners()
declaringClass
- the class to which we add the support field and methods Creates a statement body similar to:
this.fireVetoableChange("field", field, field = value)
propertyNode
- the field node for the propertyfieldExpression
- a field expression for setting the property value Creates a statement body similar to:
field = value
.
Used when the field is not also @Bindable
.
fieldExpression
- a field expression for setting the property valueCreates a setter method with the given body.
This differs from normal setters in that we need to add a declared exception java.beans.PropertyVetoException
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 Convenience method to see if an annotated node is @Vetoable
.
node
- the node to checkSnoops through the declaring class and all parents looking for a field of type VetoableChangeSupport. Remembers the field and returns false if found otherwise returns true to indicate that such support should be added.
declaringClass
- the class to searchHandles the bulk of the processing, mostly delegating to other methods.
nodes
- the AST nodessource
- the source unit for the nodes