开发者

Represent UML2 Stereotypes in EMF Ecore format to generate Java code via JET

开发者 https://www.devze.com 2023-01-24 23:59 出处:网络
working with Eclipse EMF, i am t开发者_Python百科rying to convert a uml2-model (i.e. defined as xmi) with applied profiles to ecore to be able to manipulate the code generation. Anyone has an idea on

working with Eclipse EMF, i am t开发者_Python百科rying to convert a uml2-model (i.e. defined as xmi) with applied profiles to ecore to be able to manipulate the code generation. Anyone has an idea on how this could be done nicely? As it is not possible out of the box I would figure that I would need to find a way to manipulate the way the xmi gets tranformed to ecore to represent the stereotypes in some 'ecore'-way, so that I can read them in my JET-Template...

Thanks a lot for pointing me in the right direction!

PS: This post is very related to what I want to achieve How to generate 'java code with annotations' from emf model


I have not done this before, but I think what you need to do is use the eclipse MDT/UML2 project, which helps read in your UML model file to produce an EMF model. From there, you can use the typical EMF code generation features to generate the code or templating features to generate your own custom code. There is an FAQ entry which addresses how to do this:

The UML2 project provides an Ecore importer that can be used to create Ecore (.ecore) and generator (.genmodel) models from a UML (.uml) model via the EMF project wizard ... Ultimately, UML2 uses the code generation facilities provided by EMF.


It is not possible to generate annotation from EMF directly you need to use an UML tool.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号