|Re: Accessing property values of applied stereotypes through UML2 API [message #598386]
||Thu, 08 March 2007 19:26
| Kenn Hussey
Registered: July 2009
This is a question for the UML2 newsgroup (and I'm sure questions on this
topic have been asked before...). Comments below.
"Andreas Maier" <email@example.com> wrote in message
> we are in the process of learning how to use the UML2 API in order to
> access properties of stereotypes extending some UML metaclass, let's say
> the Class metaclass.
> More precisely, we are trying to test, access and manipulate the value of
> a property P1 of a stereotype S1 applied to a UML class C1 residing in a
> user model. Obviously, the stereotype and its property are defined in some
> profile which is applied to the user model.
> We want to use the eGet(), eSet(), eUnset() and eIsSet() methods of
> EObject, to test, access and manipulate the stereotype property P1 or
> better its value in the applied stereotype.
> These methods require an EStructuralFeature as an argument which is the
> feature within the EObject the methods are invoked on.
> -> Is it correct to assume that in the above case, the EObject these
> methods are invoked on, would be the "applied stereotype" and the
> EStructuralFeature argument of the method would be the stereotype property
No, the object you would invoke these methods on is the stereotype
application, which can be obtained via the
Element#getStereotypeApplication(Stereotype) method. The feature could be
obtained from that object's Ecore class, which can be obtained either via
the stereotype application object (EObject#eClass()) or via the profile
> -> If so, what is an "applied stereotype" in EMF object terms ?
It is a dynamic object instantiated based on the Ecore representation
(definition) of the stereotype.
> -> It seems that the Property interface does not implement or subclass
> from the EStructuralFeature interface. So which object do we pass as the
> EStructuralFeature argument to these methods ?
The Ecore representation (definition) of a stereotype property can be
obtained as described above or via the Profile#getDefinition(NamedElement)
> ... I assume we are having basic problems to understand how this works. So
> don't hesitate to point out that we are being stupid ;-)
> -> Is there an example for accessing property values of applied
> stereotypes through the UML2 API ?
Yes - have you read the "Introduction to UML2 Profiles" article on the UML2
Powered by FUDForum
. Page generated in 0.01667 seconds