forked from tsaglam/EcoreMetamodelExtraction
-
Notifications
You must be signed in to change notification settings - Fork 0
3. Generator
Timur Sağlam edited this page Dec 28, 2016
·
31 revisions
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 methodgenerateMetamodelFrom()
. 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 callchangeSavingStrategy()
. A metamodel is saved (if previously generated) with the methodsaveMetamodel()
-
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 methodclear()
. The class offers methods for the creation of anEClass
and anEPackage
. 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. -
EDataTypeGenerator
is used by the classEObjectGenerator
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 methodsget()
,create()
andknows()
. The methodsknows()
checks whether the class knows a data type name. If this is the case, the data type can be accessed with the methodget()
. If this is not the case, a new data type has to be created with the methodcreate
-
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.