Serialization order for attributes [message #931475] |
Wed, 03 October 2012 08:37 |
Daniele Pala Messages: 9 Registered: September 2011 |
Junior Member |
|
|
Hello, I have a basic question: I need to serialize a model to a .csv file (one line for each object, each value corresponds to an attribute), where the order in which attributes are written is important.
By using a simple Iterator for the EAttributes I need to serialize, do I get them in the order in which they are declared in the .ecore file? For example, whith this structure:
<eClassifiers xsi:type="ecore:EClass" name="Load">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="pn" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="qn" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="#//LoadType"/>
</eClassifiers>
if I iterate over the EAttributes of a "Load" EObject, will I always get them in the order: pn-qn-type? Or the order in which they are returned is random?
Thanks,
Daniele
[Updated on: Wed, 03 October 2012 08:40] Report message to a moderator
|
|
|
Re: Serialization order for ttributes [message #931824 is a reply to message #931475] |
Wed, 03 October 2012 15:04 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
Daniele,
Yes, you get them in the order in which they appear in the model.
On 03/10/2012 10:37 AM, Daniele Pala wrote:
> Hello, I have a basic question: I need to serialize a model to a .csv
> file (one line for each object, each value corresponds to an
> attribute), where the order in which attributes are written is
> important. By using a simple Iterator for the EAttributes I need to
> serialize, do I get them in the order in which they are declared in
> the .ecore file? For example, whith this structure:
>
> <eClassifiers xsi:type="ecore:EClass" name="Load">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="pn"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="qn"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type"
> eType="#//LoadType"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="node"
> lowerBound="1" eType="#//Node"/>
> </eClassifiers>
>
> if I iterate over the EAttributes of a "Load" EObject, will I always
> get them in the order: pn-qn-type-node? Or the order in which they are
> returned is random?
>
> Thanks,
> Daniele
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02707 seconds