simple JET2 example? [message #41566] |
Thu, 07 February 2008 16:36 |
Eclipse User |
|
|
|
Originally posted by: gregwilson5.yahoo.com
We're comparing JET2 vs. FreeMarker for our code generation. We initially
compared FreeMarker against JET, and decided that FreeMarker was more
suitable, but then realized we were comparing against JET1. We've read
some about JET2, but haven't found a simple example to get us bootstrapped.
In our case, we have a few XSDs from which we've created Ecore models and
generated the corresponding model classes. We want to use instantiations
of the model classes as the input/model for our code generation.
I can see JET2's integration with JMerge as an advantage over FreeMarker,
given that we need to support protecting manually-added code in some
generated classes. Any others advantages to JET2?
Thanks,
Greg
|
|
|
Re: simple JET2 example? [message #41788 is a reply to message #41566] |
Wed, 13 February 2008 16:00 |
Paul Elder Messages: 849 Registered: July 2009 |
Senior Member |
|
|
Greg:
I won't offer any opinions on FreeMarker - I don't have any experience with
it...
Some of the strenghts of JET2:
* Eclipse integration. JET2 transformations are Eclipse workspace aware. If
you are writing content to the workspace (via tags like ws:file, java:class,
....), then you automatically get:
* participation in team environment protocols. (Some team environments
require explicit checkout before modification - the Team environment
provides for this).
* no need to write Java code to save results.
* Extensible language. Because JET2 is based on the tag library concept, it
is possible to extend the language control structures, etc....
* Extensible model navigation. Like FreeMarker, JET has an extensible
mechanism for model traversal. The language JET uses is XPath, but more than
just XML documents may be traversed. For example, out-of-the-box, JET can
traverse XML documents, and EMF-based model and the Eclipse workspace. I
have created prototypes to traverse other models including JDT ASTs, Java5/6
annotation models, ....
Paul
"Greg Wilson" <gregwilson5@yahoo.com> wrote in message
news:97ebefe31b51a5453fc143b0afcb1f87$1@www.eclipse.org...
> We're comparing JET2 vs. FreeMarker for our code generation. We initially
> compared FreeMarker against JET, and decided that FreeMarker was more
> suitable, but then realized we were comparing against JET1. We've read
> some about JET2, but haven't found a simple example to get us
> bootstrapped.
>
> In our case, we have a few XSDs from which we've created Ecore models and
> generated the corresponding model classes. We want to use instantiations
> of the model classes as the input/model for our code generation.
>
> I can see JET2's integration with JMerge as an advantage over FreeMarker,
> given that we need to support protecting manually-added code in some
> generated classes. Any others advantages to JET2?
>
> Thanks,
> Greg
>
|
|
|
Re: simple JET2 example? [message #41946 is a reply to message #41788] |
Fri, 15 February 2008 14:19 |
Eclipse User |
|
|
|
Originally posted by: ymo.noemail.com
Hi.
jet pros
1) nice editor
2) generation based on metadata and typed object
3) genration is contained in compiled java objects. This is huge if you
want to distribute your code generation as binaries and don't want your
competitors to see your code generation tekniks.
cons:
1) dependency in eclipse. This is my only grip with jet. I am trying to
ship my code generation as a canned and headless rcp application. The
problem is that jet was done with the assumption that the input file is
part of a project to be accessible. I have not found a way i can tell jet
to load a file without a reference to an existing project. Maybe Paul can
correct me here.
Also when you are generating files you cant generate them in file system.
freemarker pros:
1) can be shiped standalone
2)generation is simple files. So your template users can modify them.
freemarker cons:
1) no editors
2) cant use ${} in your template. (or i have not figured)
3) cant generate a file from within a template.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01921 seconds