Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsRe: stereotype's property
https://www.eclipse.org/forums/index.php/mv/msg/9233/28416/#msg_28416
Originally posted by: cdamus.ca.ibm.com
Hi, Asma,
If you are using the Ecore environment, then the best way is to use the
non-conformant getAppliedStereotype(...) API. This requires the
*qualified* stereotype name:
(assuming that your profile is named "MyProfile.")
However, using the UML environment, you can use OCL's ability to navigate
non-navigable association ends (a metaclass Extension is an Association):
self.extension_A.origin
You can check first that the A stereotype is applied by doing:
not self.extension_A.oclIsUndefined()
HTH,
Christian
charfi asma wrote:
> Hi,
> I have a stereotype named A with an attribute named origin,
> I want to get origin's value in my model (I have to specify a constraint
> on this value)
> so when I apply my stereotype to my connector (this stereotype extends the
> meta class Connector) I added the value using the properties menu when I
> select myconnector :(I get a new submenu (other than UML in my proprerties
> menu) which has the same name of my stereotype (A))
>
> I try this OCL expression but it did not work:
> context = myconnecter
> self.getValue(self.getAppliedStereotype('A'),'origin')
> it returns Invalid Class.
> my defaut value is (0,0) (defined in the stereotype A) this Expression
> works:
> self.getAppliedStereotype().attribute->select(name='origin').default
> it returns (0,0)
>
> So how could I get the value of my property?
>
> thanks
> asma]]>2007-06-20T13:35:02-00:00stereotype's property
https://www.eclipse.org/forums/index.php/mv/msg/9233/28380/#msg_28380
Originally posted by: asma.charfi.com
Hi,
I have a stereotype named A with an attribute named origin,
I want to get origin's value in my model (I have to specify a constraint on
this value)
so when I apply my stereotype to my connector (this stereotype extends the
meta class Connector) I added the value using the properties menu when I
select myconnector :(I get a new submenu (other than UML in my proprerties
menu) which has the same name of my stereotype (A))
I try this OCL expression but it did not work:
context = myconnecter
self.getValue(self.getAppliedStereotype('A'),'origin')
it returns Invalid Class.
my defaut value is (0,0) (defined in the stereotype A) this Expression
works:
self.getAppliedStereotype().attribute->select(name='origin').default
it returns (0,0)
So how could I get the value of my property?
thanks
asma]]>2007-06-20T19:20:36-00:00Re: stereotype's property
https://www.eclipse.org/forums/index.php/mv/msg/9233/28450/#msg_28450
Originally posted by: asma.charfi.com
Hi christian,
thank you very much! it works with the second suggestion:
I used the ocl console to check my constraint before adding it to the model
(new constraint...)
so I writed my constraint in the ocl console (I used ocl 1.1M7) and it
worked normally (it used ecore environement)
I saw that get getAppliedStereotype() needs a qualified name but I did not
know what that means ;)
Now, I added the constraint to my model and I validate (it works perfectly
cause I used ecore environement)
thank you again christian ;-)
"Christian W. Damus" <cdamus@ca.ibm.com> a ]]>2007-06-21T00:46:31-00:00