[TEXO] overriding templates question [message #623125] |
Fri, 06 August 2010 14:33 |
|
Hi !
I read about that Texo is not supporting emf's EOperation during code generation process.
I am wondering if it makes sens to override "entity_addition.xpt" template to generate code for my EOperations defined in my Ecore file which are not generated by Texo itself.
Texo documentations states that:
The template is called with model annotations as the main class. The model annotation enriches the domain model with code generation specific information (for example the java class). In addition you have access to the underlying model element (EPackage, etc.). There are model annotation for each of the main model elements (EPackage, EClass, EStructuralFeature, EReference, EAttribute, EDataType, EEnum).
So I guess it is possible to get EClass and using EMF API's extract EOperation's and generate methods signatures ?
Did any one tried that ? Or maybe I have totally misunderstood the whole concept ?
With regards, e1n
|
|
|
Re: [TEXO] overriding templates question [message #623126 is a reply to message #623125] |
Fri, 06 August 2010 20:01 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Michal,
You understand it completely correct! The default entity_addition.xpt has this code:
«DEFINE root(ModelController modelController) FOR EClassModelGenAnnotation-»
«ENDDEFINE»
so the 'this' inside the DEFINE is an instance of the EClassModelGenAnnotation class. This expression can be used to get
to the eclass:
this.EClass
and from there you can find the eoperation.
Btw, I would like to add eoperation support to Texo (just to be complete..), so if you are interested and your
implementation is generic then contributions are always wellcomed!
gr. Martin
On 08/06/2010 04:33 PM, e1n wrote:
> Hi !
>
> I read about that Texo is not supporting emf's EOperation during code
> generation process.
> I am wondering if it makes sens to override "entity_addition.xpt"
> template to generate code for my EOperations defined in my Ecore file
> which are not generated by Texo itself.
>
> Texo documentations states that: The template is called with model
> annotations as the main class. The model annotation enriches the domain
> model with code generation specific information (for example the java
> class). In addition you have access to the underlying model element
> (EPackage, etc.). There are model annotation for each of the main model
> elements (EPackage, EClass, EStructuralFeature, EReference, EAttribute,
> EDataType, EEnum).
> So I guess it is possible to get EClass and using EMF API's extract
> EOperation's and generate methods signatures ?
>
> Did any one tried that ? Or maybe I have totally misunderstood the whole
> concept ?
>
> With regards, e1n
>
--
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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.03126 seconds