Done that this.getClass() is well known at compile time, could be a
great improvement to adding support for GWT.create(this.getClass()).
For example, Guice/GIN TypeLiteral<T> is not fully emulated in web
mode because it's impossible to determine WTH is the type parameter T
(not support for equals(), hashCode(), toString(), etc.) . With
GWT.create(this.getClass()), TypeLiteral emulation could be defined
as:

class TypeLiteral<T>{

  private final TypeInfo<T> typeInfo = GWT.create(this.getClass());

  protected TypeLiteral<T>(){}

  public String toString(){
     return typeInfo.toString();
  }
  ....
}

With such feature, the UiBinder boilerplate could be fixed:

class EasyUiBinder<U, O> implements UiBinder<U,O>{
   private final UiBinder<U, O> impl = GWT.create(this.getClass());

   protected EasyUiBinder(){}

   public U createAndBindUi(O owner) {
     return impl.createAndBindUi(owner);
   }
}

UiBinder<Widget, EasyDemo> uiBinder = new EasyUiBinder<Widget,
EasyDemo>(){};

Are there technical limitations for support something like this?

- Andrés

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

Reply via email to