Stereotypes [message #1707264] |
Thu, 03 September 2015 11:19  |
Eclipse User |
|
|
|
Greetings. below is a code snip that works to print all the stereotypes and attributes of each stereotype that are applied to a class.
How do I get the value of the attribute that is attached to the stereotype?
Classes
[for (cl:Class | Class.allInstances()->sortedBy(name))]<drop/>
[cl.name/]
[for (st:Stereotype | cl.getAppliedStereotypes())]<drop/>
[st.name/]
[for (oa:Property|st.ownedAttribute)]<drop/>
[oa.name/]
[/for]<drop/>
[/for]<drop/>
[/for]<drop/>
|
|
|
Re: Stereotypes [message #1707368 is a reply to message #1707264] |
Fri, 04 September 2015 09:04   |
Eclipse User |
|
|
|
Ok... I have been looking through other posts and found this...
[cl.getValue(st, 'stereoAttribute1')/]
This will work if there is an applied stereotype that has a property called stereoAttrbute1.
What doesn't work (fails with an odd... "the file can't be opened" message when I try to open the generated word file.
[cl.getValue(st, oa.name)/] where cl is the class, st is the applied stereotype and oa is the property of the stereotype and oa.name is the name of the property of the stereotype.
thoughts?
|
|
|
Re: Stereotypes [message #1707371 is a reply to message #1707264] |
Fri, 04 September 2015 09:47   |
Eclipse User |
|
|
|
Hello,
You can show the value of attributes with the 'getValue' method as below.
[for (cl : Class | Class.allInstances()->filter(Class)->sortedBy(name))]
Class name: [cl.name/]
[for (st:Stereotype | cl.getAppliedStereotypes())]
Stereotype name: [st.name/]
[for (oa:Property|st.ownedAttribute)]
[if (not oa.name.contains('base'))]
[oa.name/]: [cl.getValue(st, oa.name)/]
[/if] <drop/>
[/for] <drop/>
[/for] <drop/>
[/for] <drop/>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02710 seconds