Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Ecore code generation strategy using inheritance(Ecore code generation strategy with inheritance)
Ecore code generation strategy using inheritance [message #890475] Fri, 22 June 2012 11:40 Go to next message
Mark Hoffmann is currently offline Mark HoffmannFriend
Messages: 113
Registered: July 2009
Location: Jena
Senior Member
Hi all,

I have a question regarding the code generation for multi-inheritance. I have an ecore
With three classes AClass, ASuperClass, BInterface. AClass has as super types: ASuperClass and BInterface. The classifiers look like this.

<eClassifiers xsi:type="ecore:EClass" name="AClass" eSuperTypes="#//BInterface #//ASuperClass"/>
<eClassifiers xsi:type="ecore:EClass" name="ASuperClass"/>
<eClassifiers xsi:type="ecore:EClass" name="BInterface" abstract="true" interface="true"/>


If I generate the code, AClassImpl looks like this:
public class AClassImpl extends EObjectImpl implements AClass { ... }
and
public interface AClass extends ASuperClass, BInterface { ... }


I expected:

public class AClassImpl extends ASuperClassImpl implements AClass { ... }
because ASuperClass contains some modified code.

I only got the last result by changing the order of the super types in AClass:

<eClassifiers xsi:type="ecore:EClass" name="AClass" eSuperTypes="#//ASuperClass #//BInterface"/>


Can anyone explain me, if this is expected behavior. After e few discussions with my colleagues I am not really sure anymore, if this is bug or feature.

Can anyone give me a hint?

Regards,
Mark
Re: Ecore code generation strategy using inheritance [message #890498 is a reply to message #890475] Fri, 22 June 2012 12:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30372
Registered: July 2009
Senior Member
Mark,

Comments below.

On 22/06/2012 7:40 AM, Mark Hoffmann wrote:
> Hi all,
>
> I have a question regarding the code generation for multi-inheritance.
> I have an ecore
> With three classes AClass, ASuperClass, BInterface. AClass has as
> super types: ASuperClass and BInterface. The classifiers look like this.
>
> <eClassifiers xsi:type="ecore:EClass" name="AClass"
> eSuperTypes="#//BInterface #//ASuperClass"/>
> <eClassifiers xsi:type="ecore:EClass" name="ASuperClass"/>
> <eClassifiers xsi:type="ecore:EClass" name="BInterface"
> abstract="true" interface="true"/>
>
> If I generate the code, AClassImpl looks like this:
> public class AClassImpl extends EObjectImpl implements AClass { ... } and
> public interface AClass extends ASuperClass, BInterface { ... }
>
> I expected:
>
> public class AClassImpl extends ASuperClassImpl implements AClass {
> ... } because ASuperClass contains some modified code.
>
> I only got the last result by changing the order of the super types in
> AClass:
>
> <eClassifiers xsi:type="ecore:EClass" name="AClass"
> eSuperTypes="#//ASuperClass #//BInterface"/>
>
> Can anyone explain me, if this is expected behavior. After e few
> discussions with my colleagues I am not really sure anymore, if this
> is bug or feature.
As you've noticed, it will generate the base class choice purely
depending on the order of the eSuperTypes.

Perhaps the generator could be a little smarter in this particular case,
but it's trivial for you to order the inheritance to produce the result
you want.
>
> Can anyone give me a hint?
>
> Regards,
> Mark
Previous Topic:[CDO] number of threads, what is normal (to be expected)
Next Topic:EMF model to Property bag
Goto Forum:
  


Current Time: Fri Aug 23 13:03:46 GMT 2019

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

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

Back to the top