[Acceleo] Accessing DataType values of a stereotype [message #1397140] |
Wed, 09 July 2014 08:59  |
Eclipse User |
|
|
|
Hello,
I am having trouble finding the appropriate set of method calls to access stereotype properties and their value when such properties are based on user-defined data type.
Below I give you a simplified version of the situation as well as a few mtl calls that I have tried with no success.
Thanks in advance for any help or suggestion.
Jean-Christophe
-- Simplified Version
Assuming a Profile Model with
1. Stereotype MyStereotype that extends the metaclass Model
2. Stereotype MyStereotype with a property P1 of type String and P2 of type MyDataType1
3. MyDataType1 has itself 2 properties P11 of type String and P12 of type MyDataType2
4. MyDataType2 has 1 property P121 of type String
and a UML Model that has the corresponding Application Profile
and where the Model has been annotated with MyStereotype
and where MyStereotype has the following values.
MyStereotype->P1 = 'P1Value'
MyStereotype->P2->P11 = 'P11Value'
MyStereotype->P2->P12->P121 = 'P121Value'
-- MTL calls tried
The lines of code below
aModel.getValue(aModel.getAppliedStereotype('Profile::MyStereotype'), 'P1')
returns (as expected) the String
P1Value
aModel.getValue(aModel.getAppliedStereotype('Profile::MyStereotype'), 'P2')
returns for example an object
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@6cb748 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@399b58 (name: MyDataType1) (instanceClassName: null) (abstract: false, interface: false))
aModel.getValue(aModel.getAppliedStereotype('Profile::MyStereotype'), 'P2').eClass()
returns an object
org.eclipse.emf.ecore.impl.EClassImpl@399b58 (name: MyDataType1) (instanceClassName: null) (abstract: false, interface: false)
aModel.getValue(aModel.getAppliedStereotype('Profile::MyStereotype'), 'P2').eClass().eAllAttributes
or alternatively,
aModel.getValue(aModel.getAppliedStereotype('Profile::MyStereotype'), 'P2').eClass().eContents
return for example an object OrderSet(OclAny)
org.eclipse.emf.ecore.impl.EAttributeImpl@557e48 (name: P12) (ordered: false, unique: true, lowerBound: 1, upperBound: 1) (changeable: true, volatile: false, transient: false, defaultValueLiteral: null, unsettable: false, derived: false) (iD: false)
However, I can neither find a way to obtain the value of P2->P11 (that is P11Value)
nor of P2->P12->P121 that is P121Value)
Thanks for any help.
|
|
|
Re: [Acceleo] Accessing DataType values of a stereotype [message #1402743 is a reply to message #1397140] |
Thu, 17 July 2014 12:22  |
Eclipse User |
|
|
|
Hi,
I have the same problem when using a profile and I'm assigning a value to a stereotype property which references another stereotyped class in the model, that is almost the same as explained in the previous post.
I think it could be related with the package registration, but I haven't find the way to get it work yet.
Another related issues I've found (but without success) are this and this.
Thanks for any additional help.
|
|
|
Powered by
FUDForum. Page generated in 0.02680 seconds