[Java] Class LegacyHashMapPropertyHandler
- groovy.transform.options.LegacyHashMapPropertyHandler
public class LegacyHashMapPropertyHandler extends ImmutablePropertyHandler
The @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.
- Since:
- 2.5.0
Fields inherited from class | Fields |
---|---|
class PropertyHandler | PROPERTY_OPTIONS_TYPE |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public Statement |
createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap) | |
public boolean |
validateAttributes(AbstractASTTransformation xform, AnnotationNode anno) | |
public boolean |
validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props) |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class ImmutablePropertyHandler | checkFinalArgNotOverridden, cloneCollectionExpr, createAsImmutableX, createConstructorStatement, createConstructorStatement, createPropGetter, createPropInit, createPropSetter, validateAttributes, validateProperties |
class PropertyHandler | createPropGetter, createPropInit, createPropSetter, createPropertyHandler, isValidAttribute, validateAttributes, validateProperties |
Method Detail
@Override public Statement createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)
@Override public boolean validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)
@Override public boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/groovy/transform/options/LegacyHashMapPropertyHandler.html