Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Extending Ecore Dynamically
Extending Ecore Dynamically [message #620904] Sun, 03 May 2009 14:33
No real name is currently offline No real nameFriend
Messages: 4
Registered: July 2009
Junior Member
Hi All,

I've been experimenting with Dynamic EMF for a while now (loving it),
and I am now trying to extend the Ecore Package itself dynamically.

What I would like to do:
1. Extend the EClass with an extra attribute (cid in this case, an extra
identifier besides 'name').
2. Create dynamic meta-models (like a Person class etc...)
3. Instantiate a person class, and being able to later get the EClass
its 'cid', like this:

short cid =
(Short)person.eClass().eGet(person.eClass().getEStructuralFe ature( "cid"));

This is what my code looks like for extending the Ecore model:

EAttribute cidAttribute = EcoreFactory.eINSTANCE.createEAttribute();
cidAttribute.setName("cid");
cidAttribute.setEType(EcorePackage.eINSTANCE.getEShort());
EcorePackage.eINSTANCE.getEClass().getEStructuralFeatures(). add(cidAttribute);

But this doesn't work, I think maybe because using
EcoreFactory.eINSTANCE will disable the extensability of the ECore
package already?

Thanks a lot in advance,
Ruben
Previous Topic:[Proposal] Edapt - Framework for Ecore model adaptation and instance migration
Next Topic:Extending Ecore Dynamically
Goto Forum:
  


Current Time: Tue Apr 16 14:40:58 GMT 2024

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

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

Back to the top