Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Getting stereotype's property values.
Getting stereotype's property values. [message #476913] Thu, 07 February 2008 13:36 Go to next message
Eclipse UserFriend
Originally posted by: antti.evesti.vtt.fi

Hi

I have connected a stereotype for a component element. Now I try to get
properties and their values from that stereotype, how I should do this?
Following code gives properties' names correctly, but I cannot find a way to
getting values for these properties. I suppose this is quite trivial task.
However, I cannot find a suitable method for this task.

Thanks,
Antti

<------------------ CODE ----------------------------------->
private void getStereotypes(Component component) {

System.out.println("** Getting stereotypes for " +
component.getLabel());


EList<Stereotype> e = component.getAppliedStereotypes();

for(Stereotype s : e) {

System.out.println(s.getLabel());

EList<Property> el = s.getAttributes();

for(Property p : el) {

System.out.println(p.getLabel());

}

}



}

}
Re: Getting stereotype's property values. [message #476915 is a reply to message #476913] Thu, 07 February 2008 14:42 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Antti,

Have a look at:
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html

Cheers,
- James

"Antti Evesti" <antti.evesti@vtt.fi> wrote in message
news:fof1gu$f31$1@build.eclipse.org...
> Hi
>
> I have connected a stereotype for a component element. Now I try to get
> properties and their values from that stereotype, how I should do this?
> Following code gives properties' names correctly, but I cannot find a way
> to getting values for these properties. I suppose this is quite trivial
> task. However, I cannot find a suitable method for this task.
>
> Thanks,
> Antti
>
> <------------------ CODE ----------------------------------->
> private void getStereotypes(Component component) {
>
> System.out.println("** Getting stereotypes for " +
> component.getLabel());
>
>
> EList<Stereotype> e = component.getAppliedStereotypes();
>
> for(Stereotype s : e) {
>
> System.out.println(s.getLabel());
>
> EList<Property> el = s.getAttributes();
>
> for(Property p : el) {
>
> System.out.println(p.getLabel());
>
> }
>
> }
>
>
>
> }
>
> }
>
>
Re: Getting stereotype's property values. [message #476916 is a reply to message #476915] Fri, 08 February 2008 06:41 Go to previous message
Eclipse UserFriend
Originally posted by: antti.evesti.vtt.fi

Thanks James!

Article gives an idea, that what I made wrong.
I called property.getValue(stereotype, property.getName()), instead of
component.getValue(stereotype, property.getName()).

BR,
Antti


"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:fof5c5$ge8$2@build.eclipse.org...
> Hi Antti,
>
> Have a look at:
> http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html
>
> Cheers,
> - James
>
> "Antti Evesti" <antti.evesti@vtt.fi> wrote in message
> news:fof1gu$f31$1@build.eclipse.org...
>> Hi
>>
>> I have connected a stereotype for a component element. Now I try to get
>> properties and their values from that stereotype, how I should do this?
>> Following code gives properties' names correctly, but I cannot find a way
>> to getting values for these properties. I suppose this is quite trivial
>> task. However, I cannot find a suitable method for this task.
>>
>> Thanks,
>> Antti
>>
>> <------------------ CODE ----------------------------------->
>> private void getStereotypes(Component component) {
>>
>> System.out.println("** Getting stereotypes for " +
>> component.getLabel());
>>
>>
>> EList<Stereotype> e = component.getAppliedStereotypes();
>>
>> for(Stereotype s : e) {
>>
>> System.out.println(s.getLabel());
>>
>> EList<Property> el = s.getAttributes();
>>
>> for(Property p : el) {
>>
>> System.out.println(p.getLabel());
>>
>> }
>>
>> }
>>
>>
>>
>> }
>>
>> }
>>
>>
>
>
Re: Getting stereotype's property values. [message #625993 is a reply to message #476913] Thu, 07 February 2008 14:42 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Antti,

Have a look at:
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html

Cheers,
- James

"Antti Evesti" <antti.evesti@vtt.fi> wrote in message
news:fof1gu$f31$1@build.eclipse.org...
> Hi
>
> I have connected a stereotype for a component element. Now I try to get
> properties and their values from that stereotype, how I should do this?
> Following code gives properties' names correctly, but I cannot find a way
> to getting values for these properties. I suppose this is quite trivial
> task. However, I cannot find a suitable method for this task.
>
> Thanks,
> Antti
>
> <------------------ CODE ----------------------------------->
> private void getStereotypes(Component component) {
>
> System.out.println("** Getting stereotypes for " +
> component.getLabel());
>
>
> EList<Stereotype> e = component.getAppliedStereotypes();
>
> for(Stereotype s : e) {
>
> System.out.println(s.getLabel());
>
> EList<Property> el = s.getAttributes();
>
> for(Property p : el) {
>
> System.out.println(p.getLabel());
>
> }
>
> }
>
>
>
> }
>
> }
>
>
Re: Getting stereotype's property values. [message #625994 is a reply to message #476915] Fri, 08 February 2008 06:41 Go to previous message
Eclipse UserFriend
Originally posted by: antti.evesti.vtt.fi

Thanks James!

Article gives an idea, that what I made wrong.
I called property.getValue(stereotype, property.getName()), instead of
component.getValue(stereotype, property.getName()).

BR,
Antti


"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:fof5c5$ge8$2@build.eclipse.org...
> Hi Antti,
>
> Have a look at:
> http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html
>
> Cheers,
> - James
>
> "Antti Evesti" <antti.evesti@vtt.fi> wrote in message
> news:fof1gu$f31$1@build.eclipse.org...
>> Hi
>>
>> I have connected a stereotype for a component element. Now I try to get
>> properties and their values from that stereotype, how I should do this?
>> Following code gives properties' names correctly, but I cannot find a way
>> to getting values for these properties. I suppose this is quite trivial
>> task. However, I cannot find a suitable method for this task.
>>
>> Thanks,
>> Antti
>>
>> <------------------ CODE ----------------------------------->
>> private void getStereotypes(Component component) {
>>
>> System.out.println("** Getting stereotypes for " +
>> component.getLabel());
>>
>>
>> EList<Stereotype> e = component.getAppliedStereotypes();
>>
>> for(Stereotype s : e) {
>>
>> System.out.println(s.getLabel());
>>
>> EList<Property> el = s.getAttributes();
>>
>> for(Property p : el) {
>>
>> System.out.println(p.getLabel());
>>
>> }
>>
>> }
>>
>>
>>
>> }
>>
>> }
>>
>>
>
>
Previous Topic:Implementation of constriants in UML models
Next Topic:Propagating stereotypes for all components
Goto Forum:
  


Current Time: Fri Aug 12 12:00:41 GMT 2022

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

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

Back to the top