Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [xpand] how to list elements of a containment reference (Ecore model)
[xpand] how to list elements of a containment reference (Ecore model) [message #638793] Fri, 12 November 2010 15:34 Go to next message
Benjamin Isnard is currently offline Benjamin IsnardFriend
Messages: 3
Registered: April 2010
Junior Member
Hello!

This is a Xpand newbie question...
I have an ECore model where the EClass API has a containment reference to EClass Module.
Therefore there is a method getModules() in the generated package for API (that returns a EList<Module>)

In my Xpand template I have the following:
«DEFINE package FOR API»
«FOREACH this.getModules() AS m-»
«EXPAND template::ModuleHPP::hpp FOR m»
«ENDFOREACH-»
«ENDDEFINE»

But I get the exception: EvaluationException : Couldn't find operation 'getModules()' for model::impl::APIImpl

What is the correct way of looping over the elements contained in the API object?

Thanks!
Benjamin

Re: [xpand] how to list elements of a containment reference (Ecore model) [message #638797 is a reply to message #638793] Fri, 12 November 2010 15:42 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14656
Registered: July 2009
Senior Member
Hello Benjamin,

just writing this.modules should do the trick.
Btw. Xpand Editor (Add Xpand/Xtend Nature and Configure it properly) should help you with content assist.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:[Xtext] Generated Antlr parser artifacts
Next Topic:[Acceleo] Constraint support ?
Goto Forum:
  


Current Time: Tue Mar 05 07:55:37 GMT 2024

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

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

Back to the top