If you don't use GIN (you know, that really should be GIn), the rest of this
note probably won't interest you.

Would something like the following improve life for GIN users enough to be
worth doing? Or is it just a hack?

public interface UiBinderWithFactory<U, O, F> extends UiBinder<U, O> {
  /**
   * Sets a factory to use when instantiating objects that are not
   * provided via @UiFactory methods or @UiField(provided = true) fields.
   * <p>
   * When an instance is needed, a zero args method with an appropriate
return type
   * will be sought on the factory to provide it. If none is found
GWT.create()
   * will be used instead.
   * <p>
   * It is a compile time error for the factory to provide ambiguous
methods.
   */
  setFactory(F factory);
}


You might wind up with code like…

@Inject
public MyWidget(MyUiBinder binder) extends Composite {

  public interface MyUiBinder extends UiBinderWithFactory<Widget, MyWidget,
MyGinjector> {
    @Inject setFactory(MyGinjector factory);
}


…and a few extra getters on your Ginjector.

Now injecting an injector is generally a terrible idea, but it's something
at least. (Does that even work in Gin? And can you put @Inject on an
interface method?)

What do you think?

rjrjr

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to