|
Re: Behaviour of EObject.eContainer() dyn. ecore != gen. model [message #425190 is a reply to message #425189] |
Tue, 18 November 2008 21:16 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, Marc,
Your situation is an instance of this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=142856
The EMF code generation does not generate the code (nor, in consequence,
the initialization) of EPackages that do not contain any classifiers.
Not even if they have sub-packages that do contain classifiers.
And, yes, I think I have seen it recommended in this newsgroup avoid
package nesting in Ecore. Think of it more like the flat namespaces of XSD.
Cheers,
Christian
Marc Schlienger wrote:
> Hello,
>
> say you have this model:
>
> pkgRoot
> |-- pkgChild1
> |-- stuff...
> |-- pkgChild2
> |-- stuff...
> |-- pkgChild3
> |-- pkgChild31
> |-- clClass311
>
> once a model instance is loaded from a serialized representation and
> used either with dynamic ecore or with the generated java classes, I
> observed a different behaviour of EObject.eContainer().
>
> Dynamic ecore works as expected, no problem.
>
> The generated java classes not. clClass311_instance.eContainer() returns
> pkgChild31_instance, but pkgChild31_instance.eContainer() returns null
> and not pkgChild3_instance as exptected...
>
> Having a look at the generated java classes, one can see that pkgChild3
> has no package factory nor metadata. This seems to be so because the
> package contains no classes, only a subpackage, namely pkgChild31. So
> the whole package hierarchy is not well initialized (init() method not
> called since not present).
>
> Did I misunderstood something concening EMF generation? or it is
> generally a bad idea to have a package hierarchy depth of more than 1
> level?
>
> Thanks
> Marc
>
|
|
|
Re: Behaviour of EObject.eContainer() dyn. ecore != gen. model [message #425191 is a reply to message #425189] |
Tue, 18 November 2008 21:18 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Marc,
Comments below.
Marc Schlienger wrote:
> Hello,
>
> say you have this model:
>
> pkgRoot
> |-- pkgChild1
> |-- stuff...
> |-- pkgChild2
> |-- stuff...
> |-- pkgChild3
> |-- pkgChild31
> |-- clClass311
>
> once a model instance is loaded from a serialized representation and
> used either with dynamic ecore or with the generated java classes, I
> observed a different behaviour of EObject.eContainer().
>
> Dynamic ecore works as expected, no problem.
>
> The generated java classes not. clClass311_instance.eContainer()
> returns pkgChild31_instance, but pkgChild31_instance.eContainer()
> returns null and not pkgChild3_instance as exptected...
Yes, it sounds like https://bugs.eclipse.org/bugs/show_bug.cgi?id=142856.
>
> Having a look at the generated java classes, one can see that
> pkgChild3 has no package factory nor metadata. This seems to be so
> because the package contains no classes, only a subpackage, namely
> pkgChild31. So the whole package hierarchy is not well initialized
> (init() method not called since not present).
>
> Did I misunderstood something concening EMF generation? or it is
> generally a bad idea to have a package hierarchy depth of more than 1
> level?
Right now it's a bad idea to expect there to be a generated EPackage for
it....
>
> Thanks
> Marc
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03316 seconds