public class ImmutablePropertyHandler extends PropertyHandler
PROPERTY_OPTIONS_TYPE
Constructor and Description |
---|
ImmutablePropertyHandler() |
Modifier and Type | Method and 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) |
createPropertyHandler, isValidAttribute
public Statement createPropGetter(PropertyNode pNode)
PropertyHandler
createPropGetter
in class PropertyHandler
pNode
- the property nodepublic Statement createPropSetter(PropertyNode pNode)
PropertyHandler
createPropSetter
in class PropertyHandler
pNode
- the property nodepublic boolean validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)
validateAttributes
in class PropertyHandler
public boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, java.util.List<PropertyNode> props)
validateProperties
in class PropertyHandler
public Statement createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)
PropertyHandler
createPropInit
in class PropertyHandler
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 notprotected Expression cloneCollectionExpr(Expression fieldExpr, ClassNode type)
protected Expression createAsImmutableX(Expression expr, ClassNode type)
protected Statement createConstructorStatement(AbstractASTTransformation xform, ClassNode cNode, PropertyNode pNode, boolean namedArgs)