Top Description Fields Constructors Methods
groovy.transform.options

public abstract Class PropertyHandler

extends Object
Class Inheritance
Known Direct Subclasses
groovy.transform.options.DefaultPropertyHandler, groovy.transform.options.ImmutablePropertyHandler
Annotations
@Incubating
Imports
groovy.lang.GroovyClassLoader, groovy.transform.PropertyOptions, org.apache.groovy.lang.annotation.Incubating, org.codehaus.groovy.ast.AnnotationNode, .ClassHelper, .ClassNode, .Parameter, .PropertyNode, org.codehaus.groovy.ast.stmt.BlockStatement, .Statement, org.codehaus.groovy.transform.AbstractASTTransformation, java.lang.annotation.Annotation, java.util.List

Used to provide custom property handling when getting, setting or initializing properties.
Since
2.5.0

Field Summary

Modifier and TypeField and Description
private static final Class<? extends Annotation>
public static final ClassNode

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static PropertyHandler
public Statement
createPropGetter(PropertyNode
the property node
pNode
)

Create the getter block used when reading the property including any defensive copying.

public abstract Statement
createPropInit(AbstractASTTransformation
the transform being processed
xform
,
AnnotationNode
the '@ImmutableBase' annotation node
anno
,
ClassNode
the classnode containing the property
cNode
,
PropertyNode
the property node to initialize
pNode
,
Parameter
an "args" Map if the property value should come from a named arg map or null if not
namedArgMap
)

Create a statement that will initialize the property including any defensive copying.

public Statement
createPropSetter(PropertyNode
the property node
pNode
)

Create the setter block used when setting the property.

protected boolean
public abstract boolean
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

PROPERTY_OPTIONS_CLASSback to summary
private static final Class<? extends Annotation> PROPERTY_OPTIONS_CLASS
PROPERTY_OPTIONS_TYPEback to summary
public static final ClassNode PROPERTY_OPTIONS_TYPE

Constructor Detail

PropertyHandlerback to summary
public PropertyHandler()

Method Detail

createPropertyHandlerback to summary
public static PropertyHandler createPropertyHandler(AbstractASTTransformation xform, GroovyClassLoader loader, ClassNode cNode)
createPropGetterback to summary
public Statement createPropGetter(PropertyNode pNode)

Create the getter block used when reading the property including any defensive copying.

Parameters
pNode:PropertyNode

the property node

createPropInitback to summary
public abstract 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:AbstractASTTransformation

the transform being processed

anno:AnnotationNode

the '@ImmutableBase' annotation node

cNode:ClassNode

the classnode containing the property

pNode:PropertyNode

the property node to initialize

namedArgMap:Parameter

an "args" Map if the property value should come from a named arg map or null if not

createPropSetterback to summary
public Statement createPropSetter(PropertyNode pNode)

Create the setter block used when setting the property. Can be null for read-only properties.

Parameters
pNode:PropertyNode

the property node

isValidAttributeback to summary
protected boolean isValidAttribute(AbstractASTTransformation xform, AnnotationNode anno, String memberName)
validateAttributesback to summary
public abstract boolean validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)
validatePropertiesback to summary
public boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)