[Xpand] Access EAnnotations [message #763236] |
Fri, 09 December 2011 06:54  |
Eclipse User |
|
|
|
Hi,
I'm writing a generator that generated code out of a ecore model with Xpand. Things work fine... but now, I want to access annotations attachted to operations defined in the ecore model. What I do is:
«IF op.EAnnotations.exists(e|e.source == "test")»
«LET op.EAnnotations.selectFirst(e|e.source == "test") AS annotation»
«annotation.details.selectFirst(e|e.key == "body").value»
«ENDLET»
«ENDIF»
to access details of a given annotation. Actually this works fine when I execute my workflow, however the xpand editor shows an error "Callable not found:Couldn't find property 'value' for type 'Object'" (the editor says annotation.details is of type List[Object].
I can get rid of the problem marker using the following code:
«IF op.EAnnotations.exists(e|e.source == "test")»
«LET op.EAnnotations.selectFirst(e|e.source == "test") AS annotation»
«annotation.details.typeSelect(ecore::EStringToStringMapEntry).selectFirst(e|e.key == "body").value»
«ENDLET»
«ENDIF»
... but the codegeneration is not working any more with that code (throwing the excpetion: "EvaluationException : Unknown type 'ecore::EStringToStringMapEntry'").
Even if the first code snipped is working, it is not satisfying to have error markers in my xpand files...
Can anybody figure out whats the problem here? Would be glad if someone could help.
Regards,
Thomas
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09449 seconds