EMF problem [message #512874] |
Mon, 08 February 2010 09:33 |
|
Hi all,
maybe i´m in the wrong forum, but i couldn´t find an adequate Forum for EMF topics.
I´m new to EMF and have a very simple question, anyway i couldn´t find a good example in the net. I want to create a class dynamically, create an attribute for the class and set its value. Everything works, except of setting the value. what do i do wrong?
EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
EcorePackage ecorePackage = EcorePackage.eINSTANCE;
// create an Company class
EClass companyClass = ecoreFactory.createEClass();
companyClass.setName("Company");
// create company name
EAttribute companyName = ecoreFactory.createEAttribute();
companyName.setName("name");
companyName.setEType(ecorePackage.getEString());
companyClass.getEStructuralFeatures().add(companyName);
companyClass.eSet(companyName, "CocaCola");
when i call eSet i get the following error Message:
java.lang.IllegalArgumentException: The feature 'name' is not a valid changeable feature
Can anybody help me?
Thanks alot!
Thomas
|
|
|
|
Powered by
FUDForum. Page generated in 0.02529 seconds