Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Stereotypes(conditional generation based on stereotype)
Stereotypes [message #1767033] Thu, 29 June 2017 17:59 Go to next message
Geoffry Roberts is currently offline Geoffry RobertsFriend
Messages: 52
Registered: July 2016
Member
How does one implement a pre condition based on a stereotype?

I have classes in my UML that have been set with stereotypes that came from a profile I created. But no matter what I cannot seem to access the stereotype name as a string. Presumably one can get a stereotype using a classes' qualified name. But I cannot get it to work.

aClass.getQualifiedName()

returns a qualified name but

aClass.getAppliedStereotype(aClass.getQualifiedName())

returns nothing.

Ultimately, I'd like to do the following:

[template public generateElement(aClass : Class) ? (aClass.getAppliedStereotype([aClass.getQualifiedName()).name.matches('federate'))]


Thanks again
Re: Stereotypes [message #1767036 is a reply to message #1767033] Thu, 29 June 2017 19:21 Go to previous message
Tomasz  Babczynski is currently offline Tomasz BabczynskiFriend
Messages: 6
Registered: May 2015
Junior Member
GetAppliedStereotype has stereotype name as a parameter.
so you could write:
aClass.getAppliedStereotypes().name->includes('Federate')
or
aClass.getAppliedStereotype('Federate')

The first gives true if setereotype is applied,the second - the stereotype object (note that in the first case getAppliedStereotype_s_ function is used)

T.B.
Previous Topic:Acceleo : How to cast in a Collection ?
Next Topic:Nothing is being generated
Goto Forum:
  


Current Time: Tue Jan 16 07:43:00 GMT 2018

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

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