Package groovy.transform.options
Class LegacyHashMapPropertyHandler
java.lang.Object
groovy.transform.options.PropertyHandler
groovy.transform.options.ImmutablePropertyHandler
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
- 
Field SummaryFields inherited from class groovy.transform.options.PropertyHandlerPROPERTY_OPTIONS_TYPE
- 
Constructor SummaryConstructors Constructor Description LegacyHashMapPropertyHandler()
- 
Method SummaryModifier and Type Method Description StatementcreatePropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)Create a statement that will initialize the property including any defensive copying.booleanvalidateAttributes(AbstractASTTransformation xform, AnnotationNode anno)booleanvalidateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, java.util.List<PropertyNode> props)Methods inherited from class groovy.transform.options.ImmutablePropertyHandlercheckFinalArgNotOverridden, cloneCollectionExpr, createAsImmutableX, createConstructorStatement, createConstructorStatement, createPropGetter, createPropSetterMethods inherited from class groovy.transform.options.PropertyHandlercreatePropertyHandler, isValidAttributeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
LegacyHashMapPropertyHandlerpublic LegacyHashMapPropertyHandler()
 
- 
- 
Method Details- 
validateAttributes- Overrides:
- validateAttributesin class- ImmutablePropertyHandler
 
- 
validatePropertiespublic boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, java.util.List<PropertyNode> props)- Overrides:
- validatePropertiesin class- ImmutablePropertyHandler
 
- 
createPropInitpublic 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.- Overrides:
- createPropInitin class- ImmutablePropertyHandler
- Parameters:
- xform- the transform being processed
- anno- the '@ImmutableBase' annotation node
- cNode- the classnode containing the property
- pNode- the property node to initialize
- namedArgsMap- an "args" Map if the property value should come from a named arg map or null if not
 
 
-