Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Dynamic EMF(Coning in dynamic EMF)
Dynamic EMF [message #1656230] Sat, 07 March 2015 12:04 Go to next message
UmaShankar Subramani is currently offline UmaShankar SubramaniFriend
Messages: 194
Registered: December 2011
Location: SWEDEN
Senior Member
I need to add an extra EAttribute to an eObject.

For doing this, I extend the eClass of this eObject using Dynamic EMF. I succeed doing that.

Then, I added eAttribute to this dynamically created eClass. Then, the extended eObject is created successfully.

Now, I want to add all the values of EStructuralFeatures from the originalObject to the extendedObject.

The following method fails to do that: What is wrong in this method?


public static EObject clone( EObject originalObject,EObject extendedObject) {


for ( Iterator i = extendedObject.eClass().getEStructuralFeatures().iterator(); i.hasNext(); )
{

EStructuralFeature feature = (EStructuralFeature) i.next();
extendedObject.eSet( feature, originalObject.eGet( feature ) );

}


return extendedObject;

}

[Updated on: Sat, 07 March 2015 12:06]

Report message to a moderator

Re: Dynamic EMF [message #1656775 is a reply to message #1656230] Sat, 07 March 2015 17:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30996
Registered: July 2009
Senior Member
Please don't cross post the same question.

On 07/03/2015 1:04 PM, UmaShankar Subramani wrote:
> I need to add an extra EAttribute to an eObject.
>
> For doing this, I extend the eClass of this eObject using Dynamic
> EMF. I succeed doing that.
> Then, I added eAttribute to this dynamically created eClass. Then, the
> extended eObject is created successfully.
>
> Now, I want to add all the EStructuralFeatures from the originalObject
> to the extendedObject.
>
> The following method fails to do that: What is wrong in this method?
>
> public static EObject clone( EObject originalObject,EObject
> extendedObject) {
>
>
> for ( Iterator i =
> extendedObject.eClass().getEStructuralFeatures().iterator();
> i.hasNext(); )
> {
>
> EStructuralFeature feature = (EStructuralFeature) i.next();
> extendedObject.eSet( feature, originalObject.eGet( feature
> ) );
>
> }
>
> return clone;
>
> }
Previous Topic:[EMFStore][EMFForms] Commit fails with checksum errir
Next Topic:[EcoreTools] damaged .aird file?
Goto Forum:
  


Current Time: Mon Mar 30 09:11:18 GMT 2020

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

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

Back to the top