Wednesday, June 11, 2008

GSOC2008: GWT magic - Deferred Binding and Generators

While reading the book further, I realized that I do not need any special library for plugging new content editors to Guvnor.

Currently, the editors are instantiated via EditorLauncher class, which provides several static methods for working with the editors. Now, we could actually remove the static property, change EditorLauncher to be interface and instantiate EditorLauncher like this:
EditorLauncher launcher = (EditorLauncher) GWT.create(EditorLauncher.class)

This will actually force the EditorLauncher implementation to be generated at the compile time using our generator (which would be subclassed from com.google.gwt.core.ext.Generator). This cool feature of GWT is called deferred binding ...
... which works by resolving and inserting the required class during compile time instead of runtime, as is the case in the Java language.

Basically, the need for any external library is diminishing in this case.

No comments: