Dynamic EMF [message #1656230] |
Sat, 07 March 2015 12:04 |
UmaShankar Subramani 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 |
Ed Merks Messages: 33136 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;
>
> }
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.01854 seconds