|
Re: Duplicate overloaded property [message #901956 is a reply to message #901935] |
Wed, 15 August 2012 09:58 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Alex,
There are several possibilities. You can hand modify the implementation
classes or interfaces with what you need. You can define operations to
do the equivalent; it's possible to suppress their visibility in the API
(see EcoreUtil.setSuppressedVisibility for how the annotation looks). Or
you could use generics, e.g., AbstClass has a parameter <T extends
Identifier> and make the reference of type T; then in ConcrClass you can
specify AbstrClass<ExtendedIdentifier>.
On 15/08/2012 9:35 AM, Alex G wrote:
> Hi!
>
> I have an ecore model A which shall describe some common abstract
> classes for other concretized ecore models. Here I have a class
> * Identifier with an attribute "id" of type EString
> * AbstrClass with a reference called "name" to an Identifier
>
> In a concretized ecore model B I have a class
> * ExtendedIdentifier which extends Identifier from A
> * ConcrClass which extends AbstrClass.
>
> Now I want also to assure, that the "name" attribute shall be a
> reference to ExtendedIdentifier. If I add such a reference, then I get
> a validation error, since I have two "name" attributes.
> In order to overcome this I could of course write two operations
> "getName" and "setName(ExtendedIdentifier)" with according explicit
> casts. There extra operations will of course pollute my metamodel,
> since I would need them very often.
> Is there a better (or another) way to solve this (expectively common)
> problem?
>
> Thank you in advance!
> Best regards,
> Alex.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03878 seconds