18.7. Creating your own generator

It’s much simpler to write your own generator than you might imagine. We find the hardest part is the amount of code you have to write and dealing with the strings when writing your new class.

Typically, you write a generator taking the stepwise approach shown in figure 18.7. Every generator follows the same pattern: extending the Generator interface and implementing the generate method. So it makes sense that we look at that first. Then you’ll need to create a new output type (usually a new class) and start writing content into it. That content will most likely be based on other artifacts of the compilation (resources, types, properties, and so on) that you can access through one of three GWT-provided oracles. ...

Get GWT in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.