The Answer to the Ultimate Question of Life, the Universe, and Everything (H2G2 – Douglas Adams)

Acceleo

Website : http://www.eclipse.org/acceleo/
Wikipedia : http://en.wikipedia.org/wiki/Acceleo

Acceleo is a template based model-to-text transformation framework implementing MOFM2T (http://www.omg.org/spec/MOFM2T/1.0/)
Navigation in the model is based upon OCL (http://en.wikipedia.org/wiki/Object_Constraint_Language).

Limitations

  • Only one input model

Template Tips

Syntax Tips

for

The foreach element allow to iterate on items of a collection.

  • before : insert text before each item
  • separator : insert text between each item
  • after : insert text after each item
  • keyword ‘i’ : allow to use the index of item in the collection ()

[for(aItem : Item | items) before(‘[‘) separator(‘,’) after(‘]’)]

item[i/]

[/for]

This will display : [item1, item2, item3, …]

Access to enumerate value

  • <Enum_Type>::<Enum_value>

Collections

  • Use of ‘->’ : perform action upon the collection (the envelop)
  • Use of ‘.’ : perform action upon each item of the list -> it results an other collection (same as ‘->collect()’)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s