Xbase: Add own EMF-classes to the model [message #1632594] |
Tue, 24 February 2015 06:12  |
Eclipse User |
|
|
|
Hello,
in order to reduce complexity of my Xbase-JvmModelInferrer I decided to extend EMF-model with some new attributes and classes:
- First I switched to Xcore using Jan's blog: http://koehnlein.blogspot.de/2013/06/using-xcore-in-xtext.html
- Then I started to add new attributes and classes
- In the JvmModelInferrer I first iterate through my model and set all the new attributes and create instances of the new classes.
- Inferring JvmModel later on I can use not only standard EMF-Model , but also all my new calculated attributes and classes, that makes inferring a lot easier. It also works as a cache.
But unfortunately this doesn't work smooth yet. There are my problems:
- I had to make all my new attributes transient in order to avoid exceptions, saying that those new attributes (references) are not mapped to the grammar and though can't be serialized.
- In the consequent runs of the JvmModelInferrer my new references get replaced with proxies making my model useless.
Here is an example of my Xcore:
// Xtext stuff. Mapped to grammar
class Parameter {
...
// Add containment reference to my new EClass
contains transient ParameterModel paramerModel opposite parameter
}
// My new class, not mapped to the grammar
class ParameterModel {
// Reference to the container
container transient Parameter parameter opposite parameterModel
// My calculated type reference (cloned with proxies)
contains transient JvmTypeReference rowType // !!! Get replaced by proxy at some point !!!
}
My question is, how to add new classes properly and is it a right way to go in the first place?
Is there some example of complex model inferring with caching?
Thank you!
Cheers,
Boris
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02805 seconds