Skip to main content



      Home
Home » Modeling » EMF » Let the root EPackage create the EFactory for every class
Let the root EPackage create the EFactory for every class [message #479529] Tue, 11 August 2009 09:02 Go to next message
Eclipse UserFriend
Hey all,

i got a metmodel in Ecore with some nested packages. As we all know, a
EFactory will be generated for every subpackage, which is aware of all
the metainformation for the containing elements...

Is it possible to retain the nested package structure, but to bundle all
the metainformation and factory methods for all (not only for the
directly contained) elements into the roots EPackage and EFactory?

I've tried it by settíng the basePackage property of the GenPackages to
the root package, but that with no success with regard to my problem.

Thanks in advance
Timothy
Re: Let the root EPackage create the EFactory for every class [message #479535 is a reply to message #479529] Tue, 11 August 2009 09:10 Go to previous messageGo to next message
Eclipse UserFriend
Timothy,

Comments below.

Timothy Marc wrote:
> Hey all,
>
> i got a metmodel in Ecore with some nested packages.
Did I ever mention how much I dislike nested packages? :-P
> As we all know, a EFactory will be generated for every subpackage,
> which is aware of all the metainformation for the containing elements...
>
> Is it possible to retain the nested package structure, but to bundle
> all the metainformation and factory methods for all (not only for the
> directly contained) elements into the roots EPackage and EFactory?
EMF certainly won't do that for you no. It would be contradictory to
merge the metadata given the fact that the XyzPackage represents the
actual EPackage. One could certainly add convenience methods to the
factory to create things from the subpackages, but that's a manual task.
>
> I've tried it by settíng the basePackage property of the GenPackages
> to the root package, but that with no success with regard to my problem.
There's no automatic way to do this.
>
> Thanks in advance
> Timothy
Re: Let the root EPackage create the EFactory for every class [message #479539 is a reply to message #479535] Tue, 11 August 2009 09:36 Go to previous messageGo to next message
Eclipse UserFriend
Ed,
so just one more stupid question: what is the benefit of nested packages
except for better clear metamodel structure? There are no more
advantages, i think. Nested packages just made the handling and creation
of model element more complicated. Or what is your opinion?

Timothy

Ed Merks schrieb:
> Timothy,
>
> Comments below.
>
> Timothy Marc wrote:
>> Hey all,
>>
>> i got a metmodel in Ecore with some nested packages.
> Did I ever mention how much I dislike nested packages? :-P
>> As we all know, a EFactory will be generated for every subpackage,
>> which is aware of all the metainformation for the containing elements...
>>
>> Is it possible to retain the nested package structure, but to bundle
>> all the metainformation and factory methods for all (not only for the
>> directly contained) elements into the roots EPackage and EFactory?
> EMF certainly won't do that for you no. It would be contradictory to
> merge the metadata given the fact that the XyzPackage represents the
> actual EPackage. One could certainly add convenience methods to the
> factory to create things from the subpackages, but that's a manual task.
>>
>> I've tried it by settíng the basePackage property of the GenPackages
>> to the root package, but that with no success with regard to my problem.
> There's no automatic way to do this.
>>
>> Thanks in advance
>> Timothy
Re: Let the root EPackage create the EFactory for every class [message #479555 is a reply to message #479539] Tue, 11 August 2009 10:08 Go to previous message
Eclipse UserFriend
Timothy,

Nested packages are no different from separate non-nested packages. I'm
not sure they even improve the structure. If you want all the metadata
in one package and all the creation methods in one factory then it
really sounds like you shouldn't have multiple packages...


Timothy Marc wrote:
> Ed,
> so just one more stupid question: what is the benefit of nested
> packages except for better clear metamodel structure? There are no
> more advantages, i think. Nested packages just made the handling and
> creation of model element more complicated. Or what is your opinion?
>
> Timothy
>
> Ed Merks schrieb:
>> Timothy,
>>
>> Comments below.
>>
>> Timothy Marc wrote:
>>> Hey all,
>>>
>>> i got a metmodel in Ecore with some nested packages.
>> Did I ever mention how much I dislike nested packages? :-P
>>> As we all know, a EFactory will be generated for every subpackage,
>>> which is aware of all the metainformation for the containing
>>> elements...
>>>
>>> Is it possible to retain the nested package structure, but to bundle
>>> all the metainformation and factory methods for all (not only for
>>> the directly contained) elements into the roots EPackage and EFactory?
>> EMF certainly won't do that for you no. It would be contradictory to
>> merge the metadata given the fact that the XyzPackage represents the
>> actual EPackage. One could certainly add convenience methods to the
>> factory to create things from the subpackages, but that's a manual task.
>>>
>>> I've tried it by settíng the basePackage property of the GenPackages
>>> to the root package, but that with no success with regard to my
>>> problem.
>> There's no automatic way to do this.
>>>
>>> Thanks in advance
>>> Timothy
Previous Topic:Dynamic EMF , instantiation of Super class
Next Topic:grouping containments for tree ui - unnecessary?
Goto Forum:
  


Current Time: Fri Jul 04 15:37:23 EDT 2025

Powered by FUDForum. Page generated in 0.05928 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top