Retrivieving stereotypes tagged values [message #1100700] |
Tue, 03 September 2013 13:11 |
saadia dhouib Messages: 36 Registered: April 2010 |
Member |
|
|
Hi,
I have a model with a uml profile applied on it.
I try to retrive the value of an attribure that is typed by an enumeration, and then to cast this value to an enumerationliteral. I notice that the cast to UML::EnumerationLiteral is not accepted!
var stereotype : Stereotype = self.getAppliedStereotypes() ->any(true);
log("stereotype", stereotype);
log("variability value: ",self.getValue(stereotype, "variability"));
var variability : UML::EnumerationLiteral =
self.getValue(self.getAppliedStereotypes()->any(true), "variability").oclAsType(UML::EnumerationLiteral);
log("variabitlity value oclAsType(UML::EnumerationLiteral)",variability);
The result in the console is:
Quote:
stereotype, data: org.eclipse.uml2.uml.internal.impl.StereotypeImpl@1d085050 (name: ModelicaValueProperty, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false)
variability value: , data: continuous
variabitlity value oclAsType(UML::EnumerationLiteral), data: <Invalid>
this is a snapshot of the setreotype:
|
|
|
Re: Retrivieving stereotypes tagged values [message #1101184 is a reply to message #1100700] |
Wed, 04 September 2013 05:33 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
So it probably isn't a UML::EnumerationLiteral. Try to find out what it
is. use eClass()/debugger.
Regards
Ed Willink
On 03/09/2013 14:11, saadia dhouib wrote:
> Hi,
>
> I have a model with a uml profile applied on it.
> I try to retrive the value of an attribure that is typed by an
> enumeration, and then to cast this value to an enumerationliteral. I
> notice that the cast to UML::EnumerationLiteral is not accepted!
>
>
> var stereotype : Stereotype = self.getAppliedStereotypes() ->any(true);
>
> log("stereotype", stereotype);
>
> log("variability value: ",self.getValue(stereotype, "variability"));
>
> var variability : UML::EnumerationLiteral =
> self.getValue(self.getAppliedStereotypes()->any(true),
> "variability").oclAsType(UML::EnumerationLiteral);
>
> log("variabitlity value oclAsType(UML::EnumerationLiteral)",variability);
>
>
> The result in the console is:
> Quote:
>> stereotype, data:
>> org.eclipse.uml2.uml.internal.impl.StereotypeImpl@1d085050 (name:
>> ModelicaValueProperty, visibility: <unset>) (isLeaf: false,
>> isAbstract: false, isFinalSpecialization: false) (isActive: false)
>> variability value: , data: continuous
>> variabitlity value oclAsType(UML::EnumerationLiteral), data: <Invalid>
>
>
> this is a snapshot of the setreotype:
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03386 seconds