Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Accessing DataType values of a stereotype(problem in accessing the value of DataType in a stereotype)
[Acceleo] Accessing DataType values of a stereotype [message #1397140] Wed, 09 July 2014 08:59 Go to next message
Jean-Christophe Deprez is currently offline Jean-Christophe DeprezFriend
Messages: 1
Registered: July 2014
Junior Member
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 Go to previous message
Javier Miranda is currently offline Javier MirandaFriend
Messages: 1
Registered: July 2014
Junior Member
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.
Previous Topic:[Xpand] Accessing enum name values
Next Topic:Package registration fails silently
Goto Forum:
  


Current Time: Thu Apr 25 07:24:51 GMT 2024

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

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

Back to the top