What is the use GWT generator?

后端 未结 6 943
[愿得一人]
[愿得一人] 2020-12-15 18:37

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

相关标签:
6条回答
  • 2020-12-15 19:00

    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.

    0 讨论(0)
  • 2020-12-15 19:06

    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?

    0 讨论(0)
  • 2020-12-15 19:11

    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

    0 讨论(0)
  • 2020-12-15 19:14

    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.

    0 讨论(0)
  • 2020-12-15 19:14

    I've started using GWT Generators where I needed Java Reflection. I've documented One of the use cases for using GWT generators here:

    http://jpereira.eu/2011/01/30/wheres-my-java-reflection/

    Hope it helps.

    0 讨论(0)
  • 2020-12-15 19:27

    Check out this implementation: http://samuelschmid.blogspot.com/2012/05/using-generator-for-generic-class.html

    You can create new Instances of classes on client with foo.newInstance("fully.qualified.class.name");

    0 讨论(0)
提交回复
热议问题