how to setValue() of a stereotype property that refers to another stereotype [message #1722930] |
Wed, 10 February 2016 05:50  |
Eclipse User |
|
|
|
Hi all,
I created a UML profile that has a stereotype (e.g. S1) with a property (s2_reference) that refers to another stereotype (S2). An example:
|-------------------------|
|<<Stereotype>> |
| S1 |
|-------------------------|
|label: String |
|s2_ref: S2 |
|-------------------------|
This stereotype is applied to a NamedElement in UML and I'm able to set the property value for types like String, Boolean, Integer. Example for property label, this code works:
namedElement.setValue(S1, labelProperty.getName, "Some String Object");
However, I'm not sure how to create an object for stereotype S2 in order to set value for property s2_ref:
namedElement.setValue(S1, s2refProperty.getName, ??);
I have tried to get to get an EObject:
EObject s2Object = s1.getStereotypeApplication(s2);
But this returns null. How do I create an instance of stereotype S2?
Many thanks,
Rajiv
|
|
|
|
|
|
Re: how to setValue() of a stereotype property that refers to another stereotype [message #1723010 is a reply to message #1722980] |
Wed, 10 February 2016 14:34  |
Eclipse User |
|
|
|
Right, with a Class you're all set then, Rajiv.
Enjoy!
Christian
On 2016-02-10 16:06:51 +0000, Rajiv Murali said:
> Hi Christian,
>
> Thank you for your reply. ''Instances of Stereotypes must always be
> applied to some element in the model.''
>
> Sorry, I'm new to UML Profile. I think I should introduce S2 as a
> regular class rather than as a stereotype (in the profile). As it don't
> intend for S2 to be applied to any UML named element.
> Thanks,
> Rajiv
|
|
|
Powered by
FUDForum. Page generated in 0.24789 seconds