User documentation
If you want to find out how to convert your own EMF models to Scala code that is ready to be used in a Synchronization context, this page is for you.
Building the generator
The generator is build using sbt. To run it, it is recommend to generate an executable JAR first.
The following commands should get you started as quick as possible:
$ git clone --recurse-submodules https://git-st.inf.tu-dresden.de/cwerner/code_generator.git
$ cd code_generator
$ sbt assembly
The resulting JAR can than be found at /target/scala-2.12/CodeGenerator-assembly-X.Y.jar
(make
sure to substitute X.Y
with your version number). It may simply be invoked using the java -jar
command (see Running the generator for details).
Running the generator
Currently the generator is supposed to be run as a command line utility. It expects the path to an
ecore
model as required argument. All other parameters are optional.
You can call the generator like this: java -jar generator.jar [ARGS] ECORE
. The following
arguments are supported:
Argument | Long | Parameter | Meaning |
---|---|---|---|
|
|
<none> |
will exclude the generated |
|
|
OPATH |
will write the generated |
|
|
MODEL |
will load a description of the model’s components. This should be a JSON-file which specifies what
classes to load and which role they play in the resulting model. A simple example for such a model
may be found at |
ECORE |
the path to the ecore XML-file which contains the model. |
If you just want to get started quickly from the IDE, the following build settings will use the
example model (the TTC17 persons use-case) found under /assets and write all resulting
intermediate files to /out in your project’s root. The final model will be placed at model.jar .
Just use -w out/raw assets/ttc17.ecore as program arguments.
|
Supported EMF features
Implemented
-
Generation of classes according to its
EAttributes
-
Traversal of inheritance hierarchies and generation of matching code (this does not include multiple inheritance yet)
-
Resolution of (containment) references as attributes
Not yet implemented
-
Re-use of methods with attached implementation in the generated code (currently all methods in the EMF will be discarded)
-
Generation of
final
attributes -
Resolution of inheritance hierarchies that utilize multiple inheritance
Known bugs
None yet.