Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Subtyping Ecore classes
Subtyping Ecore classes [message #742575] Thu, 20 October 2011 16:06 Go to next message
Peter  is currently offline Peter Friend
Messages: 6
Registered: October 2011
Junior Member
Hi,

I have a question regarding subtyping of ECore classes. Here goes...

Is it possible to subtype for instance the EAttribute or EReference class and use the derived class as basis for the framework functionality - including editors? Is the framework made in such a reflective manner that this will be supported?

As an example:

class EAttribute {}
class EAttributeNew extends EAttribute {}

Is there a way to use EAttributeNew as basis when creating Ecore models?

Have a wonderful day!
Re: Subtyping Ecore classes [message #742587 is a reply to message #742575] Thu, 20 October 2011 16:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Peter,

Comments below.

On 20/10/2011 6:06 PM, Peter wrote:
> Hi,
>
> I have a question regarding subtyping of ECore classes. Here goes...
>
> Is it possible to subtype for instance the EAttribute or EReference
> class and use the derived class as basis for the framework
> functionality - including editors?
Possible but highly discouraged.
> Is the framework made in such a reflective manner that this will be
> supported?
All other parts of the system will end up creating only the base
EAttribute or EReference class and is unlikely to make much use of your
extensions.
>
> As an example:
>
> class EAttribute {}
> class EAttributeNew extends EAttribute {}
>
> Is there a way to use EAttributeNew as basis when creating Ecore models?
No, because the editor isn't design to be extensible in this way.
>
> Have a wonderful day!
It's better to think about annotating models rather than extending
them. I.e, use Ecore's EAnnotations to add information rather than
extending the classes.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Subtyping Ecore classes [message #742636 is a reply to message #742587] Thu, 20 October 2011 17:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi
On 20/10/2011 17:16, Ed Merks wrote:
> On 20/10/2011 6:06 PM, Peter wrote:
>> Is it possible to subtype for instance the EAttribute or EReference
>> class and use the derived class as basis for the framework
>> functionality - including editors?
> Possible but highly discouraged.
As a maintainer of one Ecore-extending model, I'd put it much more
strongly. Never extend Ecore.

Ecore is optimised for Ecore and Java; consequently not everything is
arbitrarily extensible.

Ecore is very unlikely to exactly align with your 'derived'
requirements, so you will forever be compromising and compensating the
compromises.

Direct maintenance of an Ecore-like model from a text editor can be
difficult; there tends to be too great a distance between text and
interchange model; you may be better having an editor-friendly Concrete
Syntax model and an M2M to a distinct interchange-friendly Abstract
Syntax model.

Regards

Ed Willink
Re: Subtyping Ecore classes [message #743331 is a reply to message #742587] Fri, 21 October 2011 11:06 Go to previous message
Peter  is currently offline Peter Friend
Messages: 6
Registered: October 2011
Junior Member
I understand. Thank you very much for your rapid replies!

Have a good day!
Previous Topic:[Databinding/EMF] Double entries in TreeViewer ->MapChangeEvent result set incorrect.
Next Topic:CDO Table 'tnt6.cdoresourcenode' doesn't exist
Goto Forum:
  


Current Time: Fri Apr 26 16:02:04 GMT 2024

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

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

Back to the top