tags:

views:

99

answers:

4

I have seen that GWT framework is having generator feature. In what case we have to use gwt generator option and why it is needed? Can anyone tell me simply why,what is gwt generator? Done some googling. But not much helpful stuffs...

+4  A: 

From this tutorial:

Generators allow the GWT coder to generate Java code at compile time and have it then be compiled along with the rest of the project into JavaScript.

This tutorial uses the example of generating a Map of values at compile time based on a properties file.

Jason Hall
+2  A: 

One of the use cases is to mimic reflection on the client side by building a factory class on the fly. I remember answering a question posted by you earlier on how to do this

How to create new instance from class name in gwt?

So i guess you already know the application. What else are you looking for? Can you be precise?

Ashwin Prabhu
+1  A: 

I've done GWT development for 3 years now and I've written one generator :) I've written a couple of linkers for experimental purposes so I think they are more common, though still rare. The classic case is where you want to write

X x = GWT.create(X.class)

and have the particular subclass or implementation of X constructed at compile time based on, perhaps, annotations in the provided X class or interface. GWT uses them for things like the CSSResource.

Search for

"GWT Generator Experiments" site:development.lombardi.com

on google for some info about what I did.

A: 

If you refer to code generator, yes, there will a tool supporting GWT 2.1 code generation. For more details and a quick start, see http://www.springsource.org/roo/start A general roo intro is here http://blog.springsource.com/2009/05/01/roo-part-1/

Another visual tutorial is at http://www.thescreencast.com/2010/05/how-to-gwt-roo.html

Marius Andreiana