Search code examples
eclipsemodelingeclipse-emfemfecore

Override the value of an attribute in a derived Ecore-class (EMF)


I'm aware of the fact that I cannot override or redefine attributes as a whole in an ecore-based model when it comes to inheritance. But can I somehow assign a new value to an existing, inherited attribute?

E.g. Class A defines the attribute name which is a string, the default value is set to 'defaultA'. Class B inherits from Class A and name should have the value 'defaultB'.

I tried to just reimplement the attribute with the same name and datatype in Class B, but I cannot create a genmodel from that ("There may not be two features named 'name'").

Isn't it even possible to change the value of an inherited attribute?


Solution

  • No, that's not supported. The field for the feature is declared in the base class and that assigns the default defined for the feature...