Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gendoc » Stereotypes(Extracting the value of an attribute of an applied stereotype)
Stereotypes [message #1707264] Thu, 03 September 2015 11:19 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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/>
Re: Stereotypes [message #1707401 is a reply to message #1707371] Fri, 04 September 2015 13:29 Go to previous message
Eclipse UserFriend
Brilliant! Thank you. I can use this as an example to build a fragment.
Previous Topic:Gendoc 0.5.1 available
Next Topic:Question on fragment syntax
Goto Forum:
  


Current Time: Mon Feb 10 14:17:15 GMT 2025

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

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

Back to the top