Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] How to access list element?
[Acceleo] How to access list element? [message #630627] Mon, 04 October 2010 12:42 Go to next message
Tianfu Ma is currently offline Tianfu MaFriend
Messages: 6
Registered: October 2010
Junior Member
Sorry for such a newbie question. I have spent a lot of time on Acceleo user guide, wiki and examples but still cannot figure it out.

I have created an ecore model and used it to create some sample models and validated them all. Now I want to generate some code from the model.

In the template file, when I type an element name and dot (.), the content assistant pops-up.

1) I cannot find the get/set method defined in ecore genmodel file, instead, the name of elements (EReference, EAttribute etc.) are listed, but what are their types?
2) Some element has the multiplicity. How could I get it? for example a component element contains 0..* connection element, and the EReference is named as Connections, how could I know how many connection element are there (in the diagram).

Thanks in advance.
Re: [Acceleo] How to access list element? [message #630636 is a reply to message #630627] Mon, 04 October 2010 13:04 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

In order to answer your question, here is a screenshot that may help you. Don't hesitate if you have any other questions.
http://img716.imageshack.us/img716/4928/exampleeg.png

Stephane Begaudeau, Obeo


NB: eOperations for the operations of the given EClass, eAllOperations for the operation of the current EClass and the inherited operations.
Re: [Acceleo] How to access list element? [message #630660 is a reply to message #630636] Mon, 04 October 2010 13:53 Go to previous messageGo to next message
Tianfu Ma is currently offline Tianfu MaFriend
Messages: 6
Registered: October 2010
Junior Member
Wow, thank you so much. You really save the day for me. I am an C/C++ programmer and never expect the -> operation to work with Java.

Besides, we do appreciate your great product. It's so powerful.

Re: [Acceleo] How to access list element? [message #630673 is a reply to message #630627] Mon, 04 October 2010 14:18 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

In fact we are just following the OCL standard from the OMG. The dot for single elements and the arrow for collections. If you need more informations about the available operations in Acceleo, the Acceleo documentation is available in Eclipse (help -> help contents -> Acceleo Model to Text Transformation Language) or online here -> click me !

You can find there:
The documentation of OCL - OCL operations reference
The documentation of the Acceleo library - Acceleo operations reference

Stephane Begaudeau, Obeo
Previous Topic:[Xpand] Error when invoking a definition from Java with polymorphism
Next Topic:Strange errors with MWE workflow
Goto Forum:
  


Current Time: Tue Apr 16 06:11:19 GMT 2024

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

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

Back to the top