1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
<?xml version="1.0" encoding="UTF-8"?>
<merge:options
indent=" "
braceStyle="matching"
xmlns:merge="http://www.eclipse.org/org/eclipse/emf/codegen/jmerge/Options">
<!--
This test shows some advanced rules for annotations. It is important to highlight
that these rules may not be suitable for real applications, though. The problem here
is that the DictionaryPattern identifies annotations by their name, without further
analysis of the package in which the corresponding AnnotationType is defined.
In other words, a complete solution would need to distinguish the annotations
com.example.annotations.Foo and org.example.annotations.Foo. At this moment
JMerger cannot make such a distinction.
This example implements the following strategy (keep in mind that 'source' corresponds
to the new version while 'target' is the existing file, probably modified
by the developer):
- Annotations of the form @AnnotationUpdate in the target are updated with the
contents from the @AnnotationUpdate annotations in the source
- Any annotation from the source that is not available in the target is simply
added to the target
- Any annotation that only exists in the target is commented out
-->
<!--
This dictionary pattern is used to identify all annotations of the form
@AnnotationUpdate
-->
<merge:dictionaryPattern
name="Update"
select="Annotation/getName"
match="@.*Annotation(Update)"/>
<!--
With this pull rule, the contents of @AnnotationUpdate in the target is
replaced by the contents of the @AnnotationUpdate in the source.
-->
<merge:pull
sourceGet="Annotation/getContents"
targetMarkup="^Update$"
targetPut="Annotation/setContents"/>
<!--
With this sweep rule, any annotation in the target that is not available in the
source is commented out.
-->
<merge:sweep select="Annotation" action="comment"/>
</merge:options>
|