@Immutable transformation in earlier versions of Groovy tried to be smart
in the case of an immutable class with a single HashMap property, the supplied Map constructor
tried to be compatible with both expected tuple behavior and expected named-argument behavior
by peeking into the supplied map and guessing as to which approach might be applicable.
Recent versions of Groovy now allow both @TupleConstructor and @MapConstructor
annotations to co-exist which provide's a more flexible solution to this problem. While more
flexible, the new approach isn't fully compatible with the previous approach. If for some
reason you need the old behavior, you can try this property handler. Some features of the
new approach won't be available to you.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private Statement | |
| public 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 namedArgsMap)Overrides groovy. |
| public boolean | |
| public boolean | validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)
Overrides groovy. |
| HMAP_TYPE | back to summary |
|---|---|
| private static final ClassNode HMAP_TYPE | |
| LegacyHashMapPropertyHandler | back to summary |
|---|---|
| public LegacyHashMapPropertyHandler() | |
| createLegacyConstructorStatementMapSpecial | back to summary |
|---|---|
| private Statement createLegacyConstructorStatementMapSpecial(FieldNode fNode) | |
| createPropInit | back to summary |
|---|---|
| public Statement createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap) Overrides groovy. Doc from groovy. Create a statement that will initialize the property including any defensive copying. Null if no statement should be added.
| |
| validateAttributes | back to summary |
|---|---|
| public boolean validateAttributes(AbstractASTTransformation xform, AnnotationNode anno) Overrides groovy.
| |
| validateProperties | back to summary |
|---|---|
| public boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props) Overrides groovy.
| |