[ https://issues.apache.org/jira/browse/GROOVY-7422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King updated GROOVY-7422: ------------------------------ Description: When expanding a meta annotation alias into its annotation collection, it is sometimes useful to be able to control how annotations are added in particular in the presence of existing explicit annotations. This issue proposes adding an annotation parameter to {{@AnnotationCollection}} which lets the addition of collected annotations be controlled in more flexible ways. The following modes are proposed for @AC: {code} DUPLICATE: Annotations from the annotation collection will always be inserted. After all transforms have been run, it will be an error if multiple annotations (excluding those with SOURCE retention) exist. PREFER_COLLECTOR: Annotations from the collector will be added and any existing annotations with the same name will be removed. PREFER_EXPLICIT: Annotations from the collector will be ignored if any existing annotations with the same name are found. PREFER_COLLECTOR_MERGED: Annotations from the collector will be added and any existing annotations with the same name will be removed but any new parameters found within existing annotations will be merged into the added annotation. PREFER_EXPLICIT_MERGED: Annotations from the collector will be ignored if any existing annotations with the same name are found but any new parameters on the collector annotation will be added to existing annotations. {code} was: When expanding a meta annotation alias into its annotation collection, it is sometimes useful to be able to ensure the newly added annotations have a specific ordering with respect to the other annotations that might be on an annotated node. Currently there is a one size fits all approach. This issue proposes adding an annotation parameter to {{@AnnotationCollection}} which lets the collected annotations be placed at the front, end and inplace. Assuming {{@A}} and {{@C}} are annotations and {{@B}} an annotation collector aliasing two annotations {{@B1}} and {{@B2}}, then if we have the following annotation list: {{@A @B @C}} it will be replaced by the following lists of annotations: {code} FIRST: @B1 @B2 @A @C INPLACE: @A @B1 @B2 @C LAST: @A @C @B1 @B2 {code} > @AnnotationCollector could provide more control over how annotations are > added in the presence of existing explicit annotations > ------------------------------------------------------------------------------------------------------------------------------- > > Key: GROOVY-7422 > URL: https://issues.apache.org/jira/browse/GROOVY-7422 > Project: Groovy > Issue Type: Improvement > Components: xforms > Affects Versions: 2.4.3 > Reporter: Paul King > Assignee: Paul King > Fix For: 2.5.0-beta-1 > > > When expanding a meta annotation alias into its annotation collection, it is > sometimes useful to be able to control how annotations are added in > particular in the presence of existing explicit annotations. This issue > proposes adding an annotation parameter to {{@AnnotationCollection}} which > lets the addition of collected annotations be controlled in more flexible > ways. The following modes are proposed for @AC: > {code} > DUPLICATE: Annotations from the annotation collection will always be > inserted. After all transforms have been run, it will be an error if multiple > annotations (excluding those with SOURCE retention) exist. > PREFER_COLLECTOR: Annotations from the collector will be added and any > existing annotations with the same name will be removed. > PREFER_EXPLICIT: Annotations from the collector will be ignored if any > existing annotations with the same name are found. > PREFER_COLLECTOR_MERGED: Annotations from the collector will be added and any > existing annotations with the same name will be removed but any new > parameters found within existing annotations will be merged into the added > annotation. > PREFER_EXPLICIT_MERGED: Annotations from the collector will be ignored if any > existing annotations with the same name are found but any new parameters on > the collector annotation will be added to existing annotations. > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)