gwt中的注释

gwt中的注释,gwt,annotations,Gwt,Annotations,可以为GWT客户端创建简单的注释,这使我可以在客户端使用: @NewAnnotation myClass myObject 而不是: myClass myObject=new myClass()这基本上就是UiBinder使用的模式。实现此行为的方法是生成粘合代码以将值分配给字段 您将能够编写如下内容: class MyClass { @NewAnnotation SomeType field; interface MyFieldFiller extends FieldFiller

可以为GWT客户端创建简单的注释,这使我可以在客户端使用:

@NewAnnotation

myClass myObject

而不是:


myClass myObject=new myClass()

这基本上就是UiBinder使用的模式。实现此行为的方法是生成粘合代码以将值分配给字段

您将能够编写如下内容:

class MyClass {
  @NewAnnotation
  SomeType field;

  interface MyFieldFiller extends FieldFiller<MyClass> {}
  MyClass() {
    GWT.create(MyFieldFiller.class).populate(this);
  }
}
class-MyClass{
@新注释
SomeType字段;
接口MyFieldFiller扩展了FieldFiller{}
MyClass(){
create(MyFieldFiller.class).填充(this);
}
}
相反,您可能想看看它,它已经实现了一个非常健壮的依赖项注入机制