Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 13:02 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
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 13:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33146
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Let the root EPackage create the EFactory for every class [message #479539 is a reply to message #479535] Tue, 11 August 2009 13:36 Go to previous messageGo to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
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 14:08 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33146
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Dynamic EMF , instantiation of Super class
Next Topic:grouping containments for tree ui - unnecessary?
Goto Forum:
  


Current Time: Thu May 09 04:47:47 GMT 2024

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

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

Back to the top