简体   繁体   中英

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

working with Eclipse EMF, i am trying to convert a uml2-model (ie 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.

您需要使用UML工具直接从EMF生成注释。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM