[Java] Class PropertyHandler
- groovy.transform.options.PropertyHandler
Used to provide custom property handling when getting, setting or initializing properties.
- Since:
- 2.5.0
Field Summary
Modifiers | Name | Description |
---|---|---|
static ClassNode | PROPERTY_OPTIONS_TYPE |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
Statement |
createPropGetter(PropertyNode pNode) Create the getter block used when reading the property including any defensive copying. | |
Statement |
createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgMap) Create a statement that will initialize the property including any defensive copying. | |
Statement |
createPropSetter(PropertyNode pNode) Create the setter block used when setting the property. | |
static PropertyHandler |
createPropertyHandler(AbstractASTTransformation xform, GroovyClassLoader loader, ClassNode cNode) | |
protected boolean |
isValidAttribute(AbstractASTTransformation xform, AnnotationNode anno, String memberName) | |
boolean |
validateAttributes(AbstractASTTransformation xform, AnnotationNode anno) | |
boolean |
validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props) |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail
public static final ClassNode PROPERTY_OPTIONS_TYPE
Method Detail
public Statement createPropGetter(PropertyNode pNode)
Create the getter block used when reading the property including any defensive copying.
- Parameters:
-
pNode
- the property node
public Statement createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgMap)
Create a statement that will initialize the property including any defensive copying. Null if no statement should be added.
- Parameters:
-
xform
- the transform being processed -
anno
- the '@ImmutableBase' annotation node -
cNode
- the classnode containing the property -
pNode
- the property node to initialize -
namedArgMap
- an "args" Map if the property value should come from a named arg map or null if not
public Statement createPropSetter(PropertyNode pNode)
Create the setter block used when setting the property. Can be null for read-only properties.
- Parameters:
-
pNode
- the property node
public static PropertyHandler createPropertyHandler(AbstractASTTransformation xform, GroovyClassLoader loader, ClassNode cNode)
protected boolean isValidAttribute(AbstractASTTransformation xform, AnnotationNode anno, String memberName)
public boolean validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)
public boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.5.14/html/gapi/groovy/transform/options/PropertyHandler.html