JvmModelInferrer for CodeGeneration from existing model [message #1723207] |
Fri, 12 February 2016 08:37  |
Eclipse User |
|
|
|
I am using Xtend extensively now since a bit more than one year and I love it.
Currently I am writing a code generator translating an EMF model into Java code. My current approach is using Xtend and its template expressions, but the generator is growing ever more complex and now I wondered how I could make use of the JvmModelGenerator to create the code. The EMF model is provided by the users and comes from some other tool.
I have been implementing a few Xtend ActiveAnnotations lately and got to love the JvmModel and hoped this could be applied to my code generator easily. I would like to do a model transformation from my EMF model to the JvmModel and kick off the JvmModelGenerator, but I do not find a starting point. Are there any examples how to use these parts of Xtext without having your own language?
|
|
|
Re: JvmModelInferrer for CodeGeneration from existing model [message #1723567 is a reply to message #1723207] |
Tue, 16 February 2016 10:39  |
Eclipse User |
|
|
|
I'm not sure if this really pays off if you don't use Xtext and Java type references resp. xbase expressions. Haven't heard that somebody tried this before, too, but it should work like this:
- transform your EMF models to instances of the 'types' ecore file (JvmGenericType and the like).
- See DocumentationAdapter, TypeProvider, and CompilationStrategyAdapter, to add comments, method bodies and lookup types.
- inject the JvmModelGenerator and call internalDoGenerate with the resulted jvm classes.
Let us know how it worked in case you try it.
|
|
|
Powered by
FUDForum. Page generated in 0.06699 seconds