Wednesday, June 30, 2010

Re: How to simplify your GwtEvent classes and have fun doing it!

> It is a bit of a nuisance maintaining two java files for each event.

I agree that GWT events involve a lot of boilerplate.

My approach was to write an annotation processor (native Eclipse/javac
support) where you just write a "spec":

public class CalendarChangeRequestEventSpec {
Date from;
Date till;

And that's it. The event/handler/type get generated for you as soon as
you hit save. Change "from" to "foo", hit save, the generated code is
immediately up to date with a "getFoo" method instead of "getFrom",
updated hashCode, updated equals, etc. It's pretty slick.

I just recently pushed the code out to github:

- Stephen

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment