Home » Modeling » UML2 » How to access the Property values of a Stereotype?
How to access the Property values of a Stereotype? [message #478359] |
Tue, 05 May 2009 13:56 |
Timothy Marc Messages: 547 Registered: July 2009 |
Senior Member |
|
|
Hey all,
i have created a dynamic profile (i know, static profiles are much
better, however :-) ) and assigned it correctly to an uml model. No, i
programmatically traverse the uml model and want to access a property of
an stereotype.
My current approach is the following:
final EList list = (EList)umlMessage.getValue(argument, "values");
which returns an EList of DynamicEObjectImpl object. That's also
correct, because the @value attribute of my stereotyp has a 1..*
cardinality.
But when i traverse the list, i have no idea, how to access the values
of the property? I tried with
((DynamicEObjectImpl)item).eSettings(...);
but this method needs an EStructuralFeature object, and i don't know how
to find it!
I think, im totally on the woodway because, it should be quite easier to
access values of stereotype properties, shouldn't it?
Thx
Timothy
|
|
|
Re: How to access the Property values of a Stereotype? [message #478361 is a reply to message #478359] |
Wed, 06 May 2009 15:14 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
Timothy, what is the type of your stereotype property?
For primitive types, it should return an instance of the corresponding
Java primitive wrapper type.
Is it another stereotype? In that case, this might help:
http://zhaochenting.googlepages.com/usingumlprofilecustomize uml
Cheers,
Rafael
http://abstratt.com/blog/
Timothy Marc wrote:
> Hey all,
>
> i have created a dynamic profile (i know, static profiles are much
> better, however :-) ) and assigned it correctly to an uml model. No, i
> programmatically traverse the uml model and want to access a property of
> an stereotype.
>
> My current approach is the following:
>
> final EList list = (EList)umlMessage.getValue(argument, "values");
>
> which returns an EList of DynamicEObjectImpl object. That's also
> correct, because the @value attribute of my stereotyp has a 1..*
> cardinality.
>
> But when i traverse the list, i have no idea, how to access the values
> of the property? I tried with
>
> ((DynamicEObjectImpl)item).eSettings(...);
>
> but this method needs an EStructuralFeature object, and i don't know how
> to find it!
>
> I think, im totally on the woodway because, it should be quite easier to
> access values of stereotype properties, shouldn't it?
>
> Thx
> Timothy
|
|
|
Re: How to access the Property values of a Stereotype? [message #478396 is a reply to message #478359] |
Fri, 15 May 2009 13:35 |
Kenn Hussey Messages: 1620 Registered: July 2009 |
Senior Member |
|
|
Timothy,
You can obtain the Ecore metadata (e.g. structural features) for properties
defined in your profile via the Profile#getDefinition(NamedElement) method.
Once you have the structural feature, you can obtain its value via the
EObject#eGet(EStructuralFeature) method.
Alternatively, you could use the "nested" syntax supported by the
Element#getValue(Stereotype, String) method; there should be previous
threads on this newsgroup on this subject...
Kenn
"Timothy Marc" <timothymarc@freenet.de> wrote in message
news:gtpgcb$rd9$1@build.eclipse.org...
> Hey all,
>
> i have created a dynamic profile (i know, static profiles are much better,
> however :-) ) and assigned it correctly to an uml model. No, i
> programmatically traverse the uml model and want to access a property of
> an stereotype.
>
> My current approach is the following:
>
> final EList list = (EList)umlMessage.getValue(argument, "values");
>
> which returns an EList of DynamicEObjectImpl object. That's also correct,
> because the @value attribute of my stereotyp has a 1..* cardinality.
>
> But when i traverse the list, i have no idea, how to access the values of
> the property? I tried with
>
> ((DynamicEObjectImpl)item).eSettings(...);
>
> but this method needs an EStructuralFeature object, and i don't know how
> to find it!
>
> I think, im totally on the woodway because, it should be quite easier to
> access values of stereotype properties, shouldn't it?
>
> Thx
> Timothy
|
|
|
Re: How to access the Property values of a Stereotype? [message #627548 is a reply to message #478359] |
Wed, 06 May 2009 15:14 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
Timothy, what is the type of your stereotype property?
For primitive types, it should return an instance of the corresponding
Java primitive wrapper type.
Is it another stereotype? In that case, this might help:
http://zhaochenting.googlepages.com/usingumlprofilecustomize uml
Cheers,
Rafael
http://abstratt.com/blog/
Timothy Marc wrote:
> Hey all,
>
> i have created a dynamic profile (i know, static profiles are much
> better, however :-) ) and assigned it correctly to an uml model. No, i
> programmatically traverse the uml model and want to access a property of
> an stereotype.
>
> My current approach is the following:
>
> final EList list = (EList)umlMessage.getValue(argument, "values");
>
> which returns an EList of DynamicEObjectImpl object. That's also
> correct, because the @value attribute of my stereotyp has a 1..*
> cardinality.
>
> But when i traverse the list, i have no idea, how to access the values
> of the property? I tried with
>
> ((DynamicEObjectImpl)item).eSettings(...);
>
> but this method needs an EStructuralFeature object, and i don't know how
> to find it!
>
> I think, im totally on the woodway because, it should be quite easier to
> access values of stereotype properties, shouldn't it?
>
> Thx
> Timothy
|
|
|
Re: How to access the Property values of a Stereotype? [message #627583 is a reply to message #478359] |
Fri, 15 May 2009 13:35 |
Kenn Hussey Messages: 1620 Registered: July 2009 |
Senior Member |
|
|
Timothy,
You can obtain the Ecore metadata (e.g. structural features) for properties
defined in your profile via the Profile#getDefinition(NamedElement) method.
Once you have the structural feature, you can obtain its value via the
EObject#eGet(EStructuralFeature) method.
Alternatively, you could use the "nested" syntax supported by the
Element#getValue(Stereotype, String) method; there should be previous
threads on this newsgroup on this subject...
Kenn
"Timothy Marc" <timothymarc@freenet.de> wrote in message
news:gtpgcb$rd9$1@build.eclipse.org...
> Hey all,
>
> i have created a dynamic profile (i know, static profiles are much better,
> however :-) ) and assigned it correctly to an uml model. No, i
> programmatically traverse the uml model and want to access a property of
> an stereotype.
>
> My current approach is the following:
>
> final EList list = (EList)umlMessage.getValue(argument, "values");
>
> which returns an EList of DynamicEObjectImpl object. That's also correct,
> because the @value attribute of my stereotyp has a 1..* cardinality.
>
> But when i traverse the list, i have no idea, how to access the values of
> the property? I tried with
>
> ((DynamicEObjectImpl)item).eSettings(...);
>
> but this method needs an EStructuralFeature object, and i don't know how
> to find it!
>
> I think, im totally on the woodway because, it should be quite easier to
> access values of stereotype properties, shouldn't it?
>
> Thx
> Timothy
|
|
|
Goto Forum:
Current Time: Fri Mar 29 01:23:50 GMT 2024
Powered by FUDForum. Page generated in 0.02307 seconds
|