Skip to main content



      Home
Home » Modeling » UML2 » How to set multiple values for a property of a stereotype?
How to set multiple values for a property of a stereotype? [message #1863332] Fri, 26 January 2024 08:54 Go to next message
Eclipse UserFriend
Hello,

I'm wondering if we can set multiple values to a property of an applied stereotype?

I've defined a "getter" property of type Operation [1..*] on a "Property" stereotype like:

index.php/fa/43941/0/

I would like to be able to set multiple operations for the "getter" property in the Properties view of Eclipse but only one value is possible:

index.php/fa/43942/0/

Is there a way to set multiple operations?

Thanks
Re: How to set multiple values for a property of a stereotype? [message #1863333 is a reply to message #1863332] Fri, 26 January 2024 09:05 Go to previous messageGo to next message
Eclipse UserFriend
Oh it seems I succeeded but I had to unapply/reapply the stereotype on the element even if I had re-applied the profile on the entire package. Is it normal?

How to retrieve the first value of the Sequence in Acceleo?

On this image, we see the return type is a Sequence of Operation of size 2:

index.php/fa/43944/0/

But I can't get the first element, using asSequence()->at(1) give the same result (the 2 operations):

index.php/fa/43945/0/

And I would like to get only the first operation (getTransformation).
Is it possible?

[Updated on: Fri, 26 January 2024 16:17] by Moderator

Re: How to set multiple values for a property of a stereotype? [message #1863490 is a reply to message #1863333] Mon, 05 February 2024 10:02 Go to previous message
Eclipse UserFriend
When you use getAppliedStereotype() you fall back on the underlying Eclipse UML2 Java API rather than using the marginally specified type safe OMG navigation (prototyped and supported in the Pivot-based Eclipse OCL but not in the Classic Eclipse OCL used by Acceleo).

The non-typesafe navigation is particularly troublesome for non-unit multiplicities where the EList return is declared as, and so treated as, an Object, consequently it is quite possible that asSequence, created a Sequence of Sequence which at(1) only unwrapped once.

You should probably use as oclAsType to impose your better knowledge on the getAppliedStereotype() return. Or try flatten() to eliminate the ambiguity.

Previous Topic:How to generate UMLPackage object from .uml file?
Next Topic:How to get stereotypes after loading XMI resource
Goto Forum:
  


Current Time: Fri Jul 18 07:44:19 EDT 2025

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

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

Back to the top