Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Combining EMF switch classes
Combining EMF switch classes [message #653832] Fri, 11 February 2011 13:27 Go to next message
Nirmal SasidharanFriend
Messages: 120
Registered: July 2009
Location: Germany
Senior Member
Hello,

I am currently extending the EMF generated switch classes to traverse my model. Since I have many model packages, I also have multiple switch classes. I have now a requirement to combine multiple switch classes.That is, I want to use "casexxx" from different switch classes. Since java doesn't support multiple inheritance, I cannot extend multiple switch classes into one. I was thinking of a EMFSwitchDelegator class which adds multiple switch classes to a list and recursively calls doSwitch() on them till a non-null is returned. This is not possible as switch classes do not implement an interface (I have to go the ugly way of calling "doSwitch()" using Java reflection).

Do you have a better idea on how to do this? Is there any particular reason why switch classes don't implement an interface?

Thanks in advance.

Regards,
Nirmal
Re: Combining EMF switch classes [message #653846 is a reply to message #653832] Fri, 11 February 2011 13:56 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Have a look here
Re: Combining EMF switch classes [message #653955 is a reply to message #653832] Sat, 12 February 2011 02:21 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Nirmal,

I just committed the changes for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=287249 which sounds like
exactly what you need.


Nirmal Sasidharan wrote:
> Hello,
>
> I am currently extending the EMF generated switch classes to traverse
> my model. Since I have many model packages, I also have multiple
> switch classes. I have now a requirement to combine multiple switch
> classes.That is, I want to use "casexxx" from different switch
> classes. Since java doesn't support multiple inheritance, I cannot
> extend multiple switch classes into one. I was thinking of a
> EMFSwitchDelegator class which adds multiple switch classes to a list
> and recursively calls doSwitch() on them till a non-null is returned.
> This is not possible as switch classes do not implement an interface
> (I have to go the ugly way of calling "doSwitch()" using Java
> reflection).
>
> Do you have a better idea on how to do this? Is there any particular
> reason why switch classes don't implement an interface?
>
> Thanks in advance.
>
> Regards,
> Nirmal


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Help with ChangeRecorder / workbench-wide model
Next Topic:CDOSetFeatureDelta.getOldValue is always UNSPECIFIED
Goto Forum:
  


Current Time: Thu Apr 25 22:07:59 GMT 2024

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

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

Back to the top