Package groovy.transform.options
Class ImmutablePropertyHandler
java.lang.Object
groovy.transform.options.PropertyHandler
groovy.transform.options.ImmutablePropertyHandler
- Direct Known Subclasses:
LegacyHashMapPropertyHandler
-
Field Summary
Fields inherited from class groovy.transform.options.PropertyHandler
PROPERTY_OPTIONS_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StatementcheckFinalArgNotOverridden(ClassNode cNode, FieldNode fNode)protected ExpressioncloneCollectionExpr(Expression fieldExpr, ClassNode type)protected ExpressioncreateAsImmutableX(Expression expr, ClassNode type)protected StatementcreateConstructorStatement(AbstractASTTransformation xform, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)createPropGetter(PropertyNode pNode)Create the getter block used when reading the property including any defensive copying.createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)Create a statement that will initialize the property including any defensive copying.createPropSetter(PropertyNode pNode)Create the setter block used when setting the property.booleanvalidateAttributes(AbstractASTTransformation xform, AnnotationNode anno)booleanvalidateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)Methods inherited from class groovy.transform.options.PropertyHandler
createPropertyHandler, isValidAttribute
-
Constructor Details
-
ImmutablePropertyHandler
public ImmutablePropertyHandler()
-
-
Method Details
-
createPropGetter
Description copied from class:PropertyHandlerCreate the getter block used when reading the property including any defensive copying.- Overrides:
createPropGetterin classPropertyHandler- Parameters:
pNode- the property node
-
createPropSetter
Description copied from class:PropertyHandlerCreate the setter block used when setting the property. Can be null for read-only properties.- Overrides:
createPropSetterin classPropertyHandler- Parameters:
pNode- the property node
-
validateAttributes
- Specified by:
validateAttributesin classPropertyHandler
-
validateProperties
public boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)- Overrides:
validatePropertiesin classPropertyHandler
-
createPropInit
public Statement createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)Description copied from class:PropertyHandlerCreate a statement that will initialize the property including any defensive copying. Null if no statement should be added.- Specified by:
createPropInitin 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
-
createAsImmutableX
-
createConstructorStatement
protected Statement createConstructorStatement(AbstractASTTransformation xform, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap) -
checkFinalArgNotOverridden
-