Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EMF generate non-Java Code

Is there a way to generate from a ECore model code that is not Java? I have a meta-model that represent a html layout (forms, inputs, buttons) and I want to generate the html.

How can I do this? What other tools must I use? A link to a tutorial would be perfect because i haven't found one yet.

like image 240
AdrianS Avatar asked Dec 18 '25 04:12

AdrianS


1 Answers

I think the best way to approach this is to create your meta model in Ecore as you already have done, then generate the Java code and probably also an EMF tree editor to create models. (Note that the Java code for the meta model needs to be generated so that the resulting models can be traversed and interpreted by the EMF tooling. So you don't generate other languages directly from the Ecore -- that is done in a separate step as described below),

Next, use XPand -- the Xtext templating language -- to generate HTML code from your models. Here is a blog post that explains how to do create an HTML form from a model:

http://www.peterfriese.de/getting-started-with-code-generation-with-xpand/

You can likely skip the step "creating the metamodel" and just use the one you have created already. This article is a good introduction to XPand, which is a very powerful language and which some beleive is better than Jet.

like image 138
awynne Avatar answered Dec 20 '25 00:12

awynne