Home » Modeling » EMF » How to transform an ecore model into code/artifacts?
| | |
Re: How to transform an ecore model into code/artifacts? [message #1132809 is a reply to message #1132794] |
Fri, 11 October 2013 11:59 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Jean-Baptiste,
You can check out the EMF Texo project, it supports many EMF concepts, supports JSON serialization, JSON CRUD
webservices etc. OOTB. You can also easily extend the templates to generate additional stuff. Texo does not generate the
same code as EMF, there are differences, but also advantages for the use cases for Texo (web-service/server based
environments).
Here are a bunch of wiki links:
http://wiki.eclipse.org/Texo
http://wiki.eclipse.org/Texo/JSON_REST_Web_Services
http://wiki.eclipse.org/Texo/Template_Overriding
gr. Martin
On 10/11/2013 01:47 PM, Jean-Baptiste Guillois wrote:
> Hi Ed,
> Thx for your email,
>
> 1) yes, I meant I generated the EMF Model code as normal
> 2) Your proposal on doing this reflectively is a bit unclear to me... do you mean that in my own code i should
> "introspect" the instance classes' and manage it this way?
> If this is the case, then indeed it will address this very specific use case BUT i won't be able to *generate* code from
> my model. For instance:
> Let's say I have defined a class "Book" with various attributes.
> I would like to generate a "BookHelper" class that will be used for validation or other things...
>
> So my question is how can i generate this BookHelper class?
> What kind of framework should i use?
>
> Thx for your help & support,
>
> Best Regards,
>
> -- Jean-Baptiste
--
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: How to transform an ecore model into code/artifacts? [message #1134472 is a reply to message #1133006] |
Sat, 12 October 2013 14:23 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Jean-Baptiste,
It is some work to extend the Texo annotation model. It is quite possible though, I use it for the orm/jpa generation.
But I guess the easiest is to access the annotations by going to the ecore model which is loaded in-memory, any
annotations you have specified in the model (as docs) should be reachable through the api.
For examples of xpt templates see here:
http://git.eclipse.org/c/texo/org.eclipse.emf.texo.git/tree/generator/org.eclipse.emf.texo.modelgenerator/src/org/eclipse/emf/texo/modelgenerator/templates
But if you are interested in adding your own annotations model then let me know, I would need to give some pointers, but
could be a good start of a howto on the wiki also.
gr. Martin
On 10/11/2013 04:43 PM, Jean-Baptiste Guillois wrote:
> Hi Martin,
> Thx for your reply.
> I have installed Texo and succesfully generated my own stuff ;), it was pretty easy following the "Quick Start" guide.
>
> I have played a bit with the Annoted model, seems to be a cool feature :)
> Nevertheless, I am a bit stuck on how to access my own model annotations from within my xpt template file...
> Should I extend Texo annotation model?
> Should I browse my model ang search for annotations in the xpt template code?
>
> Do you have any thought on this?
>
> Thx for your help & support,
>
> Best Regards
--
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
|
|
|
Goto Forum:
Current Time: Thu Sep 19 00:42:44 GMT 2024
Powered by FUDForum. Page generated in 5.78136 seconds
|