Skip to main content



      Home
Home » Modeling » MDT (Model Development Tools) » Problems when geting values from stereotypes
Problems when geting values from stereotypes [message #380012] Fri, 03 April 2009 04:59 Go to next message
Eclipse UserFriend
Hello,

Supose I have the stereotype "Animal" with field "age:int" and inheriting
stereotype "Dog" and the element X has the "Dog" stereotype applied.

When I do X.isStereotypeApplied(Animal) it returns me false althougth
Dog is a sub-stereotype of Animal.


I would have expected that doing something like :
X.getValue(Animal,age)
it would return me the value of age field from Dog.Instead it throws me an
IllegalArgumentException because inside there is code that checks if the
Animal stereotype is applied to X.

My pourpuse is to get the value age from all stereotypes(many of them)
inheriting Animal only by accessing the getValue(Animal,age).

Is it possible or are there other solutions?


Thank in advance for your answers!
Re: Problems when geting values from stereotypes [message #380013 is a reply to message #380012] Sun, 05 April 2009 23:50 Go to previous messageGo to next message
Eclipse UserFriend
Sorin,

This question is more appropriate for the UML2 newsgroup (copied).

The behavior of the UML2 API is such that you have to specify the concrete
stereotype that is applied when asking for the value of a tag. If you want
to obtain the tagged values for multiple (sub)stereotypes, you have to write
custom client code to iterate over the list of applied substereotypes, which
can be obtained via the Element#getAppliedSubstereotypes(Stereotype) method,
and retrieve the property value for each one.

Kenn

"Sorin Fagateanu" <cyron_16@yahoo.com> wrote in message
news:c674ce81b39120454aa503ced4662c52$1@www.eclipse.org...
> Hello,
>
> Supose I have the stereotype "Animal" with field "age:int" and inheriting
> stereotype "Dog" and the element X has the "Dog" stereotype applied.
>
> When I do X.isStereotypeApplied(Animal) it returns me false althougth
> Dog is a sub-stereotype of Animal.
>
>
> I would have expected that doing something like :
> X.getValue(Animal,age) it would return me the value of age field from
> Dog.Instead it throws me an IllegalArgumentException because inside there
> is code that checks if the Animal stereotype is applied to X.
>
> My pourpuse is to get the value age from all stereotypes(many of them)
> inheriting Animal only by accessing the getValue(Animal,age).
>
> Is it possible or are there other solutions?
>
>
> Thank in advance for your answers!
>
>
Re: Problems when geting values from stereotypes [message #380014 is a reply to message #380013] Mon, 06 April 2009 02:22 Go to previous message
Eclipse UserFriend
Thank you!
Re: Problems when geting values from stereotypes [message #597588 is a reply to message #380012] Sun, 05 April 2009 23:50 Go to previous message
Eclipse UserFriend
Sorin,

This question is more appropriate for the UML2 newsgroup (copied).

The behavior of the UML2 API is such that you have to specify the concrete
stereotype that is applied when asking for the value of a tag. If you want
to obtain the tagged values for multiple (sub)stereotypes, you have to write
custom client code to iterate over the list of applied substereotypes, which
can be obtained via the Element#getAppliedSubstereotypes(Stereotype) method,
and retrieve the property value for each one.

Kenn

"Sorin Fagateanu" <cyron_16@yahoo.com> wrote in message
news:c674ce81b39120454aa503ced4662c52$1@www.eclipse.org...
> Hello,
>
> Supose I have the stereotype "Animal" with field "age:int" and inheriting
> stereotype "Dog" and the element X has the "Dog" stereotype applied.
>
> When I do X.isStereotypeApplied(Animal) it returns me false althougth
> Dog is a sub-stereotype of Animal.
>
>
> I would have expected that doing something like :
> X.getValue(Animal,age) it would return me the value of age field from
> Dog.Instead it throws me an IllegalArgumentException because inside there
> is code that checks if the Animal stereotype is applied to X.
>
> My pourpuse is to get the value age from all stereotypes(many of them)
> inheriting Animal only by accessing the getValue(Animal,age).
>
> Is it possible or are there other solutions?
>
>
> Thank in advance for your answers!
>
>
Re: Problems when geting values from stereotypes [message #597597 is a reply to message #380013] Mon, 06 April 2009 02:22 Go to previous message
Eclipse UserFriend
Thank you!
Previous Topic:Problems when geting values from stereotypes
Next Topic:ChangeCommand problem...
Goto Forum:
  


Current Time: Wed May 14 21:42:59 EDT 2025

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

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

Back to the top