Chapter 18. Generators

 

This chapter covers

  • Examining generators
  • Exploring configuration properties
  • Creating and using a generator

Wouldn’t it be nice if your toolkit could write your code for you? Imagine, you provide a few instructions and, voila, your code is produced. Although you can’t (yet) do this for a whole application, GWT gets close to this idea in a number of areas.

If you’ve used RPC, internationalization, JUnit, UiBinder, client bundles, or even dependency injection (as we described a couple of chapters ago) in your GWT application, you’ve experienced this, maybe without realizing it.

For example, with internationalization you write an interface and one or more properties files whose name(s) follow a specific naming convention. At compile time, GWT will automatically generate a set of classes that implements the interface, each class containing methods that return values from the properties file for a specific locale. These generated classes are then used in the compilation of your application, giving you a multilingual application.

18.1. What does a generator do?

18.2. What can a generator do?

18.3. Indicating what generator to use and when

18.4. Configuration properties

18.5. Pulling it all together

18.6. Preparing to write a generator

18.7. Creating your own generator

18.8. Using your new generator

18.9. Summary