README.markdown

Note: As of December 2011, gwt-mpv-apt was merged into it's sister project, gwt-mpv, which was renamed Tessell. See tessell.org for more information. The tessell-apt 2.0.0 release (which syncs the version number with the rest of Tessell) is functionality equivalent to the gwt-mpv-apt 2.2 release, except with org.tessell package names.

This does not necessarily mean gwt-mpv-apt is dead. If gwt-mpv-apt users need any bug fixes or future features done here instead of migrating to tessell-apt, post-2.2 releases are still possible, just somewhat unlikely given the gwt-mpv-ap codebase was already fairly mature and stable.

gwt-mpv-apt is a Java 6 annotation processor to help generate some of the boilerplate code involved in GWT projects.

Examples

@GenDispatch

gwt-mpv-apt will generate two classes, SubmitUserAction and SubmitUserResult. SubmitUserAction will have fields, getters, and a constructor (or two as needed for serialization) for id and name. SubmitResultResult will have the same for success, and messages. equals and hashCode are also correctly implemented if you need it for caching/etc. purposes.

All told, this is ~100 lines of boilerplate code generated from ~8 lines in the spec class.

Notes:

You must end your class name in Spec--it will be stripped and replaced with Action and Result

The @In(1)/@In(2) annotations are required for deterministic ordering due to an Eclipse bug

You can configure where Eclipse/javac puts the generated source code, which the GWT compiler will need access to

gwt-mpv-apt should auto-detect whether you are using gwt-dispatch or gwt-platform and use the respective Action/Result interfaces

@GenEvent

gwt-mpv-apt will generate two classes, FooChangedEvent and FooChangedHandler. FooChangedEvent will have fields, getters, and a constructor for foo and originator, plus static getType(), instance dispatch, etc., for it to function correctly as a GwtEvent. FooChangedHandler will be an interface with a onFooChanged method that takes a FooChangedEvent parameter.

Notes:

You must end your class name in EventSpec--it will be stripped and replaced with Event and Handler

Per @GenDispatch, the @Param(1)/@Param(2) annotations are to enforce deterministic ordering

Per @GenDispatch, you can configure where Eclipse/javac puts the generated source code, which GWT will need access to

Caveats

Eclipse

In Eclipse, you must be running Eclipse on a JDK6 JRE. This does not mean running Eclipse on JDK5 and pointing it at a JDK6 installation in "Installed JREs". For Eclipse's code-generation-as-you-type to work, Eclipse must be on a JDK6 JRE.

For Mac users, this means you need Eclipse 3.5 64-bit because it is compatible with Apple's 64-bit-only JDK6. You will not be able to run Eclipse 3.3/3.4 on Apple's 64-bit JDK6 because the Eclipse 3.3/3.4 SWT bindings are only 32-bit.

IntelliJ

Has mediocre/near-useless annotation processor support last I checked.