Generation an XMI file to java file [message #957531] |
Thu, 25 October 2012 05:41  |
Eclipse User |
|
|
|
Hello, I have created a meta-modele using the EMF and i got the file.Ecore then i generated to java files using acceleo 3.0 .
Everything is ok then i created a dynamic instance by right click on the ecore model and i filled data in the attribute and i got the XMI file.
Now i want to generate this XMi file to java file ( .java) as i did it for the ecore extension.
So is it possible to generate from .XMi to .java using acceleo and the mtl files i have????
Please i need this a solution as soon as possible if somebody can help.
Thank you in advance
|
|
|
|
Re: Generation an XMI file to java file [message #957851 is a reply to message #957597] |
Thu, 25 October 2012 10:47   |
Eclipse User |
|
|
|
Charbel,
Acceleo operates on any EMF model, not only ".ecore" ones. Generating code from your xmi file is as easy as providing them to your launch config. However, your templates have been created to operated on ecore objects (EClass, EOperation, EAttribute...). The objects from your dynamic instance are not elements applying to the ecore metamodel, but elements applying to your own metamodel (as defined in "file.ecore").
For example, you may have created a class named "Library" in your model "file.ecore". When you launch acceleo with file.ecore, generating code from that object needs a template applying to (its first parameter) EClass. When you create a dynamic instance of your "Library" class, the template that applies to that dynamic instance must have its first parameter to be of type "Library".
In other words : yes, you can generate code from your dynamic instance through Acceleo, whatever the file extension; but no, you can't use the same generators for both the Ecore metamodel and your dynamic instance (that is in fact a model which metamodel is that 'file.ecore' from which you created it).
Laurent Goubet
Obeo
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03722 seconds