[TEXO] Enum documentation [message #883308] |
Fri, 08 June 2012 09:03 |
Gary Godfrey Messages: 31 Registered: February 2012 |
Member |
|
|
Hi Martin,
How can I ensure documentation is added to the generated Enum please?
Example XSD section:
<xs:simpleType name="TelephoneType">
<xs:restriction base="xs:string">
<xs:enumeration value="TETY1">
<xs:annotation>
<xs:documentation>Mobile</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="TETY2">
<xs:annotation>
<xs:documentation>LandLine</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
The .ecore correctly extracts the required documentation:
<eClassifiers xsi:type="ecore:EEnum" name="TelephoneType">
<eAnnotations source="org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="TelephoneType"/>
</eAnnotations>
<eLiterals name="TETY1">
<eAnnotations source="org/emf/2002/GenModel">
<details key="documentation" value="Mobile"/>
</eAnnotations>
</eLiterals>
<eLiterals name="TETY2" value="1">
<eAnnotations source="org/emf/2002/GenModel">
<details key="documentation" value="LandLine"/>
</eAnnotations>
</eLiterals>
</eClassifiers>
In enum.xpt I cannot though determine how to access the value. e.g. Mobile or LandLine
The key section of my enum.xpt is:
«FOREACH eEnum.ELiterals AS e SEPARATOR ","-»
«LET ((EEnumLiteral)e) AS el-»
/**
* The enum: «toUpperCase(el.literal)»
* <!-- begin-user-doc -->
$$$$
Trying to add Mobile / Landline here
$$$$
* <!-- end-user-doc -->
* @generated
*/
«modelController.getJavaAnnotations(el, "field")-»
«toUpperCase(el.literal)»
«ENDLET-»
«ENDFOREACH-»;
Regards,
Gary
[Updated on: Fri, 08 June 2012 09:24] Report message to a moderator
|
|
|
Re: Enum documentation [message #883359 is a reply to message #883308] |
Fri, 08 June 2012 11:07 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Gary,
Can you try something like this:
«IF this.documentation != null-»
* <!-- begin-model-doc -->
* «this.documentation»
* <!-- end-model-doc -->
«ENDIF-»
gr. Martin
On 06/08/2012 11:03 AM, Gary Godfrey wrote:
> Hi Martin,
>
> How can I ensure documentation is added to the generated Enum please?
> Example XSD section:
>
> <xs:simpleType name="TelephoneType">
> <xs:restriction base="xs:string">
> <xs:enumeration value="TETY1">
> <xs:annotation>
> <xs:documentation>Mobile</xs:documentation>
> </xs:annotation>
> </xs:enumeration>
> <xs:enumeration value="TETY2">
> <xs:annotation>
> <xs:documentation>LandLine</xs:documentation>
> </xs:annotation>
> </xs:enumeration>
> </xs:restriction>
> </xs:simpleType>
>
>
> The .ecore correctly extracts the required documentation:
>
> <eClassifiers xsi:type="ecore:EEnum" name="TelephoneType">
> <eAnnotations source="org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="TelephoneType"/>
> </eAnnotations>
> <eLiterals name="TETY1">
> <eAnnotations source="org/emf/2002/GenModel">
> <details key="documentation" value="Mobile"/>
> </eAnnotations>
> </eLiterals>
> <eLiterals name="TETY2" value="1">
> <eAnnotations source="org/emf/2002/GenModel">
> <details key="documentation" value="LandLine"/>
> </eAnnotations>
> </eLiterals>
> </eClassifiers>
>
>
> In enum.xpt I cannot though determine how to access the value. e.g. Mobile or LandLine
>
> The key section of my enum.xpt is:
>
> «FOREACH eEnum.ELiterals AS e SEPARATOR ","-»
> «LET ((EEnumLiteral)e) AS el-»
> /**
> * The enum: «toUpperCase(el.literal)»
> * <!-- begin-user-doc -->
> $$$$
> Trying to add Mobile / Landline here
> $$$$
> * <!-- end-user-doc -->
> * @generated
> */
> «modelController.getJavaAnnotations(el, "field")-»
> «toUpperCase(el.literal)»
> «ENDLET-»
> «ENDFOREACH-»;
>
> Regards,
> Gary
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
|
Re: Enum documentation [message #883450 is a reply to message #883431] |
Fri, 08 June 2012 15:02 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Okay, let me test it locally, I will do a new build later today which then also should solve this.
gr. Martin
On 06/08/2012 04:10 PM, Gary Godfrey wrote:
> Hi Martin,
>
> Tried this but didn't work:
>
>
> «FOREACH eEnum.ELiterals AS e SEPARATOR ","-»
> «LET ((EEnumLiteral)e) AS el-»
> /**
> * The enum: «toUpperCase(el.literal)»
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * <!-- begin-model-doc -->
> «IF this.documentation != null-»
> * «this.documentation»
> * <!-- end-model-doc -->
> «ENDIF-»
>
> * @generated
> */
> «modelController.getJavaAnnotations(el, "field")-»
> «toUpperCase(el.literal)»
> «ENDLET-»
> «ENDFOREACH-»;
>
>
> The corresponding Enum prints:
>
> public enum TelephoneType
> {
>
> /**
> * The enum: TETY1 <!-- begin-user-doc --> TETY1 <!-- end-user-doc --> <!--
> * begin-model-doc -->
> * * @generated
> */
> TETY1
>
> , /**
> * The enum: TETY2 <!-- begin-user-doc --> TETY2 <!-- end-user-doc -->
> * <!-- begin-model-doc -->
> * * @generated
> */
> TETY2
>
> ;
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Re: Enum documentation [message #883543 is a reply to message #883431] |
Fri, 08 June 2012 18:43 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Gary,
I published a new build which should work, to get the documentation you have to do this:
«IF getDocumentation(el) != null-»
* <!-- begin-model-doc -->
* «getDocumentation(el)»
* <!-- end-model-doc -->
«ENDIF-»
gr. Martin
On 06/08/2012 04:10 PM, Gary Godfrey wrote:
> Hi Martin,
>
> Tried this but didn't work:
>
>
> «FOREACH eEnum.ELiterals AS e SEPARATOR ","-»
> «LET ((EEnumLiteral)e) AS el-»
> /**
> * The enum: «toUpperCase(el.literal)»
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * <!-- begin-model-doc -->
> «IF this.documentation != null-»
> * «this.documentation»
> * <!-- end-model-doc -->
> «ENDIF-»
>
> * @generated
> */
> «modelController.getJavaAnnotations(el, "field")-»
> «toUpperCase(el.literal)»
> «ENDLET-»
> «ENDFOREACH-»;
>
>
> The corresponding Enum prints:
>
> public enum TelephoneType
> {
>
> /**
> * The enum: TETY1 <!-- begin-user-doc --> TETY1 <!-- end-user-doc --> <!--
> * begin-model-doc -->
> * * @generated
> */
> TETY1
>
> , /**
> * The enum: TETY2 <!-- begin-user-doc --> TETY2 <!-- end-user-doc -->
> * <!-- begin-model-doc -->
> * * @generated
> */
> TETY2
>
> ;
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.03912 seconds