public class ImmutablePropertyHandler
extends PropertyHandler
Property handler used by immutable-style transforms.
| Fields inherited from class | Fields |
|---|---|
class PropertyHandler |
PROPERTY_OPTIONS_TYPE |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected Statement |
checkFinalArgNotOverridden(ClassNode cNode, FieldNode fNode)Creates a statement that rejects overriding a final property value via constructor arguments. |
|
protected Expression |
cloneCollectionExpr(Expression fieldExpr, ClassNode type)Returns an immutable defensive-copy expression for the supplied collection value. |
|
protected Expression |
createAsImmutableX(Expression expr, ClassNode type)Creates an asImmutable() call for the supplied expression and target type. |
|
protected Statement |
createConstructorStatement(AbstractASTTransformation xform, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)Creates the constructor statement used to initialize an immutable property. |
|
public Statement |
createPropGetter(PropertyNode pNode)Create the getter block used when reading the property including any defensive copying.
|
|
public Statement |
createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)Create a statement that will initialize the property including any defensive copying. Null if no statement should be added.
|
|
public Statement |
createPropSetter(PropertyNode pNode)Create the setter block used when setting the property. Can be null for read-only properties.
|
|
public boolean |
validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)Validates annotation attributes supported by this handler.
|
|
public boolean |
validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)Validates the properties selected for processing.
|
| Methods inherited from class | Name |
|---|---|
class PropertyHandler |
createPropGetter, createPropInit, createPropSetter, createPropertyHandler, isValidAttribute, validateAttributes, validateProperties |
Creates a statement that rejects overriding a final property value via constructor arguments.
cNode - the owning classfNode - the final fieldReturns an immutable defensive-copy expression for the supplied collection value.
fieldExpr - the original field expressiontype - the declared property type Creates an asImmutable() call for the supplied expression and target type.
expr - the source expressiontype - the type used for the cast before invoking asImmutable()Creates the constructor statement used to initialize an immutable property.
xform - the active transformcNode - the owning classpNode - the property being initializednamedArgsMap - the named-argument map, or nullCreate the getter block used when reading the property including any defensive copying.
pNode - the property nodeCreate a statement that will initialize the property including any defensive copying. Null if no statement should be added.
xform - the transform being processedanno - the '@ImmutableBase' annotation nodecNode - the classnode containing the propertypNode - the property node to initializenamedArgMap - an "args" Map if the property value should come from a named arg map or null if notCreate the setter block used when setting the property. Can be null for read-only properties.
pNode - the property nodeValidates annotation attributes supported by this handler.
xform - the active transformanno - the property options annotationtrue if validation succeedsValidates the properties selected for processing.
xform - the active transformbody - the statement block being generatedcNode - the owning classprops - the candidate propertiestrue if validation succeeds