Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
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 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
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 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
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 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
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 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
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
Previous Topic:problems with pathmap
Next Topic:Re: FilteredUsageCrossReferencer
Goto Forum:
  


Current Time: Fri Mar 29 01:23:50 GMT 2024

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

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

Back to the top