[QVTo] Weird thing about Stereotypes application [message #653396] |
Wed, 09 February 2011 11:15  |
Eclipse User |
|
|
|
Hi,
i have a weird problem, and i don't have any explanation.
I'm writing a trasformation from Ecore to UML, based on the example
http:// dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.m2m/org.eclip se.m2m.qvt.oml/examples/org.eclipse.m2m.qvt.oml.econ2009.tut orial/projects/qvto.ecore2uml/transforms/Ecore2UML.qvto?revi sion=1.4&root=Modeling_Project
In the INIT section i load a not-static profile that includes a stereotype (named 'cpp_pointer') that extends the Parameter metaclass
In the mapping EClass:toClass(), i have added a part of code to add a new operation for each reference with multiplicity greater than one.
self.eReferences->forEach(i|i.upperBound <> 1){
var name_string:String = 'add'+i.name.firstToUpper();
var pointer:Stereotype = uml2cpp.objectsOfType(Stereotype)->any(name = 'cpp_pointer');
ownedOperation += object uml::Operation {
visibility := VisibilityKind::public;
type := umlModel.objectsOfType(UML::DataType)->any(temp:UML::DataType | temp.name = 'EInt');
name := name_string;
var param = object uml::Parameter {
name := 'value';
type := umlModel.objectsOfType(UML::Class)->any(temp:UML::Class | temp.name = i.eType.name);
};
param.applyStereotype(pointer);
ownedParameter += param;
};
As you can see, in the last part of the code section, i apply the stereotype. But when i look at the uml file, the profile is correctly applied to the model but there isn't any reference to the stereotype application to the parameters above.
Weird thing is that, when I apply the stereotype in the END section of EPackage:toPackage() (basically the last function to be called back)
var s:Set(Parameter) = umlModel.objectsOfType(Parameter)[not oclIsInvalid() and getApplicableStereotypes()->notEmpty()];
s->forEach(i) {
var o:Operation = i.operation;
var pointer:Stereotype = i.getApplicableStereotypes()->any(name = 'cpp_pointer');
if(o.name.startsWith('add') and i.name = 'value') then i.applyStereotype(pointer) endif;
}
then everything it's ok.
I hope to have been clear and i hope that someone can give me an explanation.
Thanks in advance
|
|
|
|
Powered by
FUDForum. Page generated in 0.02940 seconds