Package groovy.transform.options
Class ImmutablePropertyHandler
- java.lang.Object
-
- groovy.transform.options.PropertyHandler
-
- groovy.transform.options.ImmutablePropertyHandler
-
- Direct Known Subclasses:
LegacyHashMapPropertyHandler
public class ImmutablePropertyHandler extends PropertyHandler
-
-
Field Summary
-
Fields inherited from class groovy.transform.options.PropertyHandler
PROPERTY_OPTIONS_TYPE
-
-
Constructor Summary
Constructors Constructor Description ImmutablePropertyHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Statement
checkFinalArgNotOverridden(ClassNode cNode, FieldNode fNode)
protected Expression
cloneCollectionExpr(Expression fieldExpr, ClassNode type)
protected Expression
createAsImmutableX(Expression expr, ClassNode type)
protected Statement
createConstructorStatement(AbstractASTTransformation xform, ClassNode cNode, PropertyNode pNode, boolean namedArgs)
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 namedArgsMap)
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.boolean
validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)
boolean
validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, java.util.List<PropertyNode> props)
-
Methods inherited from class groovy.transform.options.PropertyHandler
createPropertyHandler, isValidAttribute
-
-
-
-
Method Detail
-
createPropGetter
public Statement createPropGetter(PropertyNode pNode)
Description copied from class:PropertyHandler
Create the getter block used when reading the property including any defensive copying.- Overrides:
createPropGetter
in classPropertyHandler
- Parameters:
pNode
- the property node
-
createPropSetter
public Statement createPropSetter(PropertyNode pNode)
Description copied from class:PropertyHandler
Create the setter block used when setting the property. Can be null for read-only properties.- Overrides:
createPropSetter
in classPropertyHandler
- Parameters:
pNode
- the property node
-
validateAttributes
public boolean validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)
- Specified by:
validateAttributes
in classPropertyHandler
-
validateProperties
public boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, java.util.List<PropertyNode> props)
- Overrides:
validateProperties
in classPropertyHandler
-
createPropInit
public Statement createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)
Description copied from class:PropertyHandler
Create a statement that will initialize the property including any defensive copying. Null if no statement should be added.- Specified by:
createPropInit
in classPropertyHandler
- Parameters:
xform
- the transform being processedanno
- the '@ImmutableBase' annotation nodecNode
- the classnode containing the propertypNode
- the property node to initializenamedArgsMap
- an "args" Map if the property value should come from a named arg map or null if not
-
cloneCollectionExpr
protected Expression cloneCollectionExpr(Expression fieldExpr, ClassNode type)
-
createAsImmutableX
protected Expression createAsImmutableX(Expression expr, ClassNode type)
-
createConstructorStatement
protected Statement createConstructorStatement(AbstractASTTransformation xform, ClassNode cNode, PropertyNode pNode, boolean namedArgs)
-
-