Recipes to build Code Generators for Non-Xtext Models with Xtend
The Xtend Language with its Rich String concept is a perfect match to build template based code generators. When using Xtext based models, it is quite easy to implement a generator by implementing the IGenerator interface. The Xtext framework enables integration of such generators in standalone and integrated environments with minimal customization effort.
But what if the generator's input not resources of Xtext DSLs, like plain POJOs, EMF resources, or UML? Xtend itself does not provide a generator framework, and Xtext's infrastructure is on first sight only suitable for Xtext resources.
In this talk we will explain how to build a custom code generator with Xtext's generator framework for models which are not Xtext DSL models. The resulting generator will be executable from a command line or a build and integrates into the Eclipse UI. Further we will show a more lighweight approach without dependencies on Xtext for simple use cases.
Karsten Thoms, Holger Schill