Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » How to solve this (reflective?) problem in EMF?
How to solve this (reflective?) problem in EMF? [message #609639] Tue, 04 September 2007 11:20
Paul is currently offline PaulFriend
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
Previous Topic:Re: Web-Frontend for EMF models
Next Topic:How to solve this (reflective?) problem in EMF?
Goto Forum:
  


Current Time: Fri Aug 19 01:45:08 GMT 2022

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

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

Back to the top