Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Access EAnnotations
[Xpand] Access EAnnotations [message #763236] Fri, 09 December 2011 11:54 Go to next message
thomas.kipar is currently offline thomas.kiparFriend
Messages: 13
Registered: July 2011
Junior Member
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
Re: [Xpand] Access EAnnotations [message #763302 is a reply to message #763236] Fri, 09 December 2011 14:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,


should this note be op.eAnnotations (with a lower case e)

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 09 December 2011 14:37]

Report message to a moderator

Re: [Xpand] Access EAnnotations [message #763882 is a reply to message #763302] Sat, 10 December 2011 20:18 Go to previous messageGo to next message
thomas.kipar is currently offline thomas.kiparFriend
Messages: 13
Registered: July 2011
Junior Member
Chrstian,

lower case e isn't working for me at all in that case (it says: Callable not found:Couldn't find property 'eAnnotations' for type 'org::eclipse::emf::ecore::EOperation'). As said before, I am able to access the annotations, however I have trouble accessing the details (key-value entries).
Re: [Xpand] Access EAnnotations [message #763887 is a reply to message #763882] Sat, 10 December 2011 20:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

do you use javabeans metamodel or emf metamodel?
and do you use the same in ide and workflow?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sat, 10 December 2011 20:35]

Report message to a moderator

Re: [Xpand] Access EAnnotations [message #763906 is a reply to message #763887] Sat, 10 December 2011 21:42 Go to previous messageGo to next message
thomas.kipar is currently offline thomas.kiparFriend
Messages: 13
Registered: July 2011
Junior Member
Hi,

thanks, you got the problem. I used the javabeans metamodel all the time (but started to mix it up with the emf metamodel). If I switch over to the emf metamodel, it should work (I guess). Is there, on the other hand, a way to access the annotation details using the javabeans metamodel?
Re: [Xpand] Access EAnnotations [message #763908 is a reply to message #763906] Sat, 10 December 2011 21:44 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi,

using a java extension should help you to fix the lacking map support

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:[Xpand] Questions regarding implementing MetaModelContributor
Next Topic:[XPAND] Can't find references to metamodel from template
Goto Forum:
  


Current Time: Fri Apr 19 18:05:40 GMT 2024

Powered by FUDForum. Page generated in 0.03045 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top