How to figure out all attributes and associations of any model class [message #495243] |
Wed, 04 November 2009 10:18 |
Eclipse User |
|
|
|
Originally posted by: formatzeh.gmx.de
I'm currently working in an environment where several generated EMF
meta-models can be situated. So it happens that I get a concrete model
and want to print out some information about it. For example I get the
root EObject with the following statement:
EObject root = resource.getContents().get(0);
Now I want to iterate over every class in this class hierarchy and want
to print out every property which where modeled in the meta-model. Is it
possible anyhow to figure out generically for any model class for any
meta-model the properties? Until now I only do reflection to see if an
EObject has a "getName()" method to print out the name. I hope I
expressed myself understandable.
best regards,
Gilbert
|
|
|
Re: How to figure out all attributes and associations of any model class [message #495316 is a reply to message #495243] |
Wed, 04 November 2009 14:52 |
Eclipse User |
|
|
|
Originally posted by: c.krause.cwi.nl
Hi Gilbert,
EMF is fully reflective. Try root.eClass(). This gives you the
corresponding ECLass from where you can explore the whole class and
package content. It might also help to take a look at the Ecore metamodel.
Cheers,
Christian
Gilbert Mirenque wrote:
> I'm currently working in an environment where several generated EMF
> meta-models can be situated. So it happens that I get a concrete model
> and want to print out some information about it. For example I get the
> root EObject with the following statement:
>
> EObject root = resource.getContents().get(0);
>
> Now I want to iterate over every class in this class hierarchy and want
> to print out every property which where modeled in the meta-model. Is it
> possible anyhow to figure out generically for any model class for any
> meta-model the properties? Until now I only do reflection to see if an
> EObject has a "getName()" method to print out the name. I hope I
> expressed myself understandable.
>
> best regards,
> Gilbert
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03270 seconds