Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsHow to solve this (reflective?) problem in EMF?
https://www.eclipse.org/forums/index.php/mv/msg/192022/609639/#msg_609639
I hope I can describe my problem in an understandable way:
I tried to create an Oultine Page using a set of classes (which are
extending EObjectImpl) as its content.
Now, the problem is that for the content I can only get the superclass
EObject and not the "real" class representing the object itself (e.g. ECar
extends EObject, EDoor extends EObject)
whereas I'd like to display the attributes of the objects as part of the
Outline Page (e.g. ECar.type, EDoor.color).
My codes look like below.
Because of some reasons, I'd like not to cast the EObject (to be able to
call ECar.getType()) , but it still somehow must diplay the attributes of
the "real" class behind it, instead of just displaying the name of the class
by calling e.eClass().getName(); so this should happen dynamically. It is
possible to use sort of reflective in EMF? Or is there any better solution
to this?
EObject e = null;
Outline o = null;
for(Iterator iter = ecoreRoot.eContents().iterator(); iter.hasNext();)