| [news.eclipse.tools.emf] Re: How to change the EObjectImpl used for dynamical loaded models (rootExtendsClass for dynamic models)? |
Michael,
Comments below.
Not so easily. You'd have to swizzle the package's default factory that's used otherwise. I always thought that would be a cool thing to be able to do this more easily...Suppose, I have a dynamically loaded model. Is there a way to control the EObjectImpl that is used for the instances?
Not at the moment.
Currently I have a generated model
@namespace(uri="platform:/plugin/x.y.z/generated/root.ecore", prefix="root")
package root;
class EObjectImplRoot{ }
and in my dynamic models each object has to inherit from
the root:
@namespace(uri="platform:/plugin/x.y.z/dynamic/dyn.ecore", prefix="dyn")
package dyn;
import "platform:/plugin/x.y.z/generated/root.ecore";
class DynObject extends root.EObjectImplRoot { }
That works fine. I just wonder if there is a way to make that happen automatically.
No. This same type of issue came up in SDO where we needed to extend EDataObjectImpl. So we just swizzle the factory on the packages we load before we start using them. I always figured it would be nice if there were some way via EAnnotations on the package to either control the entire factory that's used (which could be important for custom EDataTypes) or control which classes are created by that factory.In the genmodel there is the attribute "rootExtendsClass" attribute to control the root class. Is there a way to control the EObject of dynamic instances.
Michael