Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326291

Summary: Add new methods on Element to handle multi-valued stereotype attribute
Product: [Modeling] MDT.UML2 Reporter: Alessandro Romero <romgerale>
Component: CoreAssignee: UML2 Inbox <mdt-uml2-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: Kenn.Hussey
Version: 3.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Alessandro Romero CLA 2010-09-27 07:49:34 EDT
I would like to suggest that org.eclipse.uml2.uml.Element should have a specific method to handle multi-valued stereotype attribute.

 org.eclipse.emf.common.util.EList<java.lang.Object> getValue(Stereotype stereotype, java.lang.String propertyName)  

To be used such as listed below:

Element e = ....;

EList<Object> list = e.getMultiValue(stereotype, "feature");

This is important to use UML2 on MOF QVT Operational transformations, because using somethig like this:

x := class.getValue(stereotype,"feature").oclAsType(EEList).asSequence(); 
x+= b;

It generates error, because getValue returns Object so x expects type oclstdlib::T.

-----------
More details about version and environment:

Eclipse Modeling Galileo - Build id: 20100218-1602

UML2 - org.eclipse.uml2 - Version: 3.0.1.v200908281330 Build id: 200908281428
Comment 1 Kenn Hussey CLA 2010-09-27 10:13:28 EDT
I hesitate to add such a method, since the current getValue(...) method essentially mimics the analog in EMF, eGet(...). Does this same problem exist when doing something similar for Ecore models?

Is there no way to "cast" the result of getValue(...) so that the right type is expected?
Comment 2 Alessandro Romero CLA 2010-09-27 11:26:39 EDT
Sorry, I have been so focused on my problem and how to resolve based on messages and mailing list, such as:

http://dev.eclipse.org/newslists/news.eclipse.modeling.m2m/msg04703.html

That I stopped to try cast elements (so simple).

modeltype OCL     uses ocl('http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore');

x := class.getValue(stereotype,"feature").oclAsType(EEList).asSequence(); 
x+= b.oclAsType(oclstdlib::T);

Work very well!

Please ignore this enhancement!
Comment 3 Kenn Hussey CLA 2010-09-27 13:25:49 EDT
OK, resolving this as "won't fix".
Comment 4 Kenn Hussey CLA 2011-05-31 10:37:25 EDT
Closing for Indigo release.