How to solve this (reflective?) problem in EMF? [message #609639] |
Tue, 04 September 2007 11:20 |
Paul Messages: 55 Registered: July 2009 |
Member |
|
|
Hallo,
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();)
{
e = (EObject)iter.next();
if(e.eClass().getName() != null) {
a = new Outline(e, e.eClass().getName());
}
}
........................
Many thanks for ideas.
Best Regards
|
|
|
Powered by
FUDForum. Page generated in 0.02960 seconds