[Acceleo] Ordered unbound choices / EFeatureMapEntry [message #917937] |
Thu, 20 September 2012 11:22  |
Eclipse User |
|
|
|
Hello,
I am new to Ecore and Acceleo so I'll try my best to be clear.
I've generated a model based on an XSD containing unbound choices. The order of the elements is important.
<xs:complexType name="MyChoicesType">
<xs:sequence>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="A" type="AType">
</xs:element>
<xs:element name="B" type="BType">
</xs:element>
<xs:element name="C" type="CType">
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
The model contains 4 lists: one for each element types, and a list of EFeatureMapEntry named "group".
What I understand from http://www.eclipse.org/modeling/emf/docs/overviews/FeatureMap.pdf is that I shall be able to retrieve the order of the elements thanks to the "group".
Now from the acceleo module, the iteration over the group is ok with:
[for (e: EFeatureMapEntry | sample.group)]
but I don't know how to get the value from the EFeatureMapEntry object since getValue() operation seems to not be available.
So the obvious question: is it possible, and if so, how ?
Thanks for your help,
Franck
|
|
|
|
Re: [Acceleo] Ordered unbound choices / EFeatureMapEntry [message #940205 is a reply to message #931534] |
Thu, 11 October 2012 08:17  |
Eclipse User |
|
|
|
Laurent,
Your solution works perfectly.
For other beginners, here is the wrapping example :
[query public getValue(entry : EFeatureMapEntry) : OclAny
= invoke('org.eclipse.emf.ecore.util.FeatureMap$Entry',
'getValue()',
Sequence{entry}) /]
Nothing else is needed, that's great !
Thanks,
Franck
|
|
|
Powered by
FUDForum. Page generated in 0.24340 seconds