[Ecore] deep copying properties of Ecore elements without subcontents [message #660277] |
Thu, 17 March 2011 16:15 |
leonard.krpan Messages: 20 Registered: March 2011 |
Junior Member |
|
|
I'm processing an Ecore model where the resulting model is a subset of the original one, but should be an independet model without any references to the original one.
I'm using a TreeIterator to process model elements one at a time. If an element (EPackage, EClass, EAttribute or EReference) should be a part of the resulting model, I create a new appropriate Ecore class and then I need to set all the properties as in the original element. However, I do not want to set references such as subpackages, since at the moment that I'm processing this package I don't know which of it's subpackages will fulfill the processing conditions to be taken into the resulting model. So,
I just tried using EcoreUtil.copy and EcoreUtil.Copier.copy but they both have the effect of copying everything the package contains, which I don't want - I need the package alone, cut off from it's super and subpackages...
Is there a way to this other than stripping the copied package contents manually?
|
|
|
Re: [Ecore] deep copying properties of Ecore elements without subcontents [message #660291 is a reply to message #660277] |
Thu, 17 March 2011 16:37 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
You could specialize copyContainment to ignore certain containment
references.
lk_muc wrote:
> I'm processing an Ecore model where the resulting model is a subset of
> the original one, but should be an independet model without any
> references to the original one.
>
> I'm using a TreeIterator to process model elements one at a time. If
> an element (EPackage, EClass, EAttribute or EReference) should be a
> part of the resulting model, I create a new appropriate Ecore class
> and then I need to set all the properties as in the original element.
> However, I do not want to set references such as subpackages, since at
> the moment that I'm processing this package I don't know which of it's
> subpackages will fulfill the processing conditions to be taken into
> the resulting model. So,
> I just tried using EcoreUtil.copy and EcoreUtil.Copier.copy but they
> both have the effect of copying everything the package contains, which
> I don't want - I need the package alone, cut off from it's super and
> subpackages...
>
> Is there a way to this other than stripping the copied package
> contents manually?
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03058 seconds