Is it possible to create an EMF package from java code at runtime?

297 Views Asked by At

I want to create EMF models from java code at runtime. The generative approach doesn't suit my needs because every time the java classes change, I'm forced to update my model. I want a model that exactly corresponds to my java code, so I can convert EMF objects to java objects and vice versa. I googled my problem and found MoDisco that does the job but it is doing it at design time.

1

There are 1 best solutions below

1
On

This is definitely possible and is done by EMF behind the scene all the time. Have a look at the generated ...Package.java for an example.

Also see EMF generate model class from ECore XMI at runtime and http://www.informit.com/articles/article.aspx?p=1323360&seqNum=5