You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Timur Sağlam edited this page Aug 17, 2017
·
3 revisions
Ecore Model Code Generation
EMF already offers a code generator for the generation of model code from Ecore metamodels. Therefore this part of the Ecorification relies, like the Metamodel extraction itself, heavily on the Ecore API.
To generate the model code, an Ecore GenModel has to be created for the metamodel. This generator model contains additional information for the model code generation. The creation of a GenModel is implemented in the class GenModelGenerator, while the API calls for the model code generation are implemented in the class ModelCodeGenerator.
GenModel Generator
The class GenModelGenerator allows creating GenModels with the method generate(). The method takes a GeneratedEcoreMetamodel as the parameter. A GenModelGenerator can be initialized with default values and with custom
values. The values affect the GenModel configuration. The default values are:
The class ModelCodeGenerator generates code from an existing GenModel with the help of the Ecore API class org.eclipse.emf.codegen.ecore.generator.Generator. To do this, one has to call generate(GenModel genModel) with a valid GenModel as parameter.
The class utilizes the class MonitorToLoggerAdapter to feed the output stream of the code generation into a log4j logger. This allows receiving information about the generation process.