Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Dynamic EMF(Coning in dynamic EMF)
Dynamic EMF [message #1656230] Sat, 07 March 2015 07:04 Go to next message
Eclipse UserFriend
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 07:06] by Moderator

Re: Dynamic EMF [message #1656775 is a reply to message #1656230] Sat, 07 March 2015 12:31 Go to previous message
Eclipse UserFriend
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: Sun Jul 27 09:43:36 EDT 2025

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

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

Back to the top