[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: How to change the EObjectImpl used for dynamical loaded models (rootExtendsClass for dynamic models)?

Michael,

Comments below.


Michael Scharf wrote:
Suppose, I have a dynamically loaded model. Is there a way
to control the EObjectImpl that is used for the instances?
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...

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.
Not at the moment.
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.
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.

I'm noticing that the feature request list is growing significantly faster than I've been able to remove items from it though. Soon (today?) Dave will be finished the book, and then we can try to clear some of the backlog of almost-done things...


Michael