Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » How to get the child classes only?
How to get the child classes only? [message #1826080] Sat, 18 April 2020 11:52 Go to next message
Eclipse UserFriend
Hello Everyone!

i just want to get the child classes of specific class e.g; NODE (the name of the parent class) .
i have tried many operations but they are not working for me :(, like

[for (c: EClass | anEPackage.eAllContents())]
[if (c.name.toString() = 'NODE')]
[if (c.eContainer().oclAsType(NODE))][/comment]
[for (cc: EClass | c.eContents(EClass))][cc.name/]
[for (a:EAttribute | cc.eAllContents())][a.name/] [/for]
[for (r:EReference | cc.eAllContents())][r.name/] [/for]
[/for]
[/if]

[/for]

Regards,
fatima
Re: How to get the child classes only? [message #1826082 is a reply to message #1826080] Sat, 18 April 2020 13:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Easy. It's Set{} since EMF does not support nested classes.

Regards

Ed Willink
Re: How to get the child classes only? [message #1826116 is a reply to message #1826082] Sun, 19 April 2020 15:24 Go to previous messageGo to next message
Eclipse UserFriend
Hi Willink!
Thanks for reply ! problem solved. :)

Another question , how to get specific attribute of a class in a for loop?

Regards,
fatima
Re: How to get the child classes only? [message #1826129 is a reply to message #1826116] Mon, 20 April 2020 01:02 Go to previous message
Eclipse UserFriend
Hi

New question should be new topic.

An attribute of a class is invariant so you get get it just the same as you would outside the loop. Something like: MyClass.ownedAttributes->select(name = wantedName).

Refards

Ed Willink
Previous Topic:Compile Accelo with Maven&Tycho&Travis
Next Topic:How to read the graphical notations?
Goto Forum:
  


Current Time: Thu Apr 24 20:18:34 EDT 2025

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

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

Back to the top