Iterate on classes using associations [message #1788395] |
Wed, 30 May 2018 13:19  |
Eclipse User |
|
|
|
Hello,
I need to travel from a class to another using an association and I need to have the 'Class Object' in Acceleo because I have to iterate on its methods.
I am able to obtain the name of the target class of the association but I can't use the same trick to obtain the class object because I have a type 'Type'.
I attach my code to explain better my environment .
[template public getPOSTHandler(c : Class)]
[for (a : Association | c.getAssociations())]
[for (s : Stereotype | a.getAppliedStereotypes())]
[if (s.name.equalsIgnoreCase('ConcreteObjectRef')) and (not a.ownedEnd.getOtherEnd()->at(1).type.name.equalsIgnoreCase(c.name) )]
# Obtain Name
[a.ownedEnd.getOtherEnd()->at(1).type.name/]
# What I need to do:
[a.ownedEnd.getOtherEnd()->at(1).type.findPOSTHandler()/]
[/if]
[/for]
[/for]
[/template]
[template public findPOSTHandler(c : Class)]
[for (op:Operation | c.getAllOperations()) ]
[for (s : Stereotype | op.getAppliedStereotypes())]
[if s.name.equalsIgnoreCase('POSTHandler')]
[op.name/][/if]
[/for]
[/for]
[/template]
Thank you in advance.
Dim
|
|
|
|
Powered by
FUDForum. Page generated in 0.05411 seconds