How to determine stereotype of class in EGL? [message #1775813] |
Mon, 06 November 2017 18:01 |
Kaan Koseler Messages: 2 Registered: November 2017 |
Junior Member |
|
|
Hello,
I apologize if this is a newbie question. I am trying to access the stereotype of a class in an EGL template. I already created a UML profile with several defined stereotypes and created a model with them. Now in the EGL template, I want to determine which stereotype has been applied to the classes.
One stereotype I defined is called an "ObservedVariable" and I would like to gather all "ObservedVariable" classes from my model into a variable.
For example, this is what I have in my template:
[%
var observedVars = Class.all.hasAppliedStereotypes("ObservedVariable");
%]
I then receive the following error (where "Strikes" has the "ObservedVariable" stereotype applied):
Method 'hasAppliedStereotypes' not found for: Sequence {Class [name=Strikes, qualifiedName=RootElement::Strikes, visibility=public, isLeaf=false, isAbstract=false, isFinalSpecialization=false, isActive=false, ]
Can anyone provide any guidance?
Thank you very much
|
|
|
|
|
Re: How to determine stereotype of class in EGL? [message #1776284 is a reply to message #1775962] |
Wed, 15 November 2017 02:11 |
Kaan Koseler Messages: 2 Registered: November 2017 |
Junior Member |
|
|
Hello Dimitris,
Thank you kindly for your reply and the informative links. After reading through them I managed to figure it out :)
This is somewhat off topic from my original question but it's a minor enough question:
when placing an EString data type within an EGL template, is there any way to remove the brackets that surround the EString in the generated code?
For example I have the following code:
[%=c.stereotypeApplications.trainValues%]
where trainValues is an EString with value: { 0, 1, 2, 3, 4}
In the generated code, the result shows up as: [{0, 1, 2, 3, 4}]
Is there any way to remove these brackets and just leave the original string?
Thank you again, I greatly appreciate your help.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03002 seconds