2011-06-09 35 views
2

它可以創建GWT客戶端,它給我的可能性,在客戶端使用簡單的註解:代替註釋在GWT

@NewAnnotation

myClass myObject

myClass myObject=new myClass();

回答

6

這實質上是UiBinder使用的模式。實現此行爲的方法是生成粘合代碼以將值分配給字段的write a Generator

你就可以寫類似:

class MyClass { 
    @NewAnnotation 
    SomeType field; 

    interface MyFieldFiller extends FieldFiller<MyClass> {} 
    MyClass() { 
    GWT.create(MyFieldFiller.class).populate(this); 
    } 
} 

,你可能覺得GIN看起來相反,它已經實現了一個非常強大的依賴注入機制。