Skip to main content



      Home
Home » Modeling » EMF » Duplicate overloaded property
Duplicate overloaded property [message #901935] Wed, 15 August 2012 03:35 Go to next message
Eclipse UserFriend
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.
Re: Duplicate overloaded property [message #901956 is a reply to message #901935] Wed, 15 August 2012 05:58 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Duplicate overloaded property [message #902217 is a reply to message #901956] Thu, 16 August 2012 08:10 Go to previous message
Eclipse UserFriend
Thank you very much. Didn't know that ecore is able to define generics.
Previous Topic:[EMF-Databinding] Observe addition/removal changes in multi-value feature of a multi-value feature
Next Topic:EMF Compare - CompareServices?
Goto Forum:
  


Current Time: Wed Jul 23 16:40:48 EDT 2025

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

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

Back to the top