Skip to content
Timur Sağlam edited this page Dec 29, 2016 · 31 revisions

The Ecore Metamodel Generator

The Generator in the package eme.generator consists out of different generator classes:

  • EcoreMetamodelGenerator is the main generator class, it manages the whole generation process and handles the other generator classes. To create an Ecore metamodel, use this class exclusivly, it manages the calls to all other generators. Creating a metamodle can be achieved with the method generateMetamodelFrom(). The main generator class also manages the saving strategy. Initially the saving strategy is set according to the properties class, but it can be changed during the runtime with the method call changeSavingStrategy(). A metamodel is saved (if previously generated) with the method saveMetamodel()
  • EObjectGenerator is the the class that actually generates the metamodel components (Ecore objects) from the intermediate model. The functionality of the class is tied to its instance of a intermediate model. Creating metamodel components with this class without previously setting the inetrmediate model is not recommended because it can lead to unwanted behavior. Between the creation of components for two different models, the class should be cleared with the method clear(). The class offers methods for the creation of an EClass and an EPackage. In both methods the Ecore objects for all the contained elements (subpackages, classes, methods etc.) are automatically created. That means those methods should be called for root elements. !!! TODO: update !!!
  • EDataTypeGenerator is used by the class EObjectGenerator to manage data types. The class basically maps data type names to the data types. It also creates and stores new data types. It offers the methods get(), create() and knows(). The methods knows() checks whether the class knows a data type name. If this is the case, the data type can be accessed with the method get(). If this is not the case, a new data type has to be created with the method create
  • EMFProjectGenerator can be used by saving strategies to create an empty EMF project in for the Eclipse IDE.
  • The subpackage eme.generator.saving is explained in the next chapter.
Clone this wiki locally