GWT 2.4是否支持这种情况:
@Entity class MyBase {...}
@Entity class MyChild1 extends MyBase {...}
@Entity class MyChild2 extends MyBase {...}
...
@ProxyFor(MyBase.class) class MyBaseProxy extends EntityProxy {...}
@ProxyFor(MyChild1.class) class MyChild1Proxy extends MyBaseProxy {...}
@ProxyFor(MyChild2.class) class MyChild2Proxy extends MyBaseProxy {...}
...
@Service(ArticleBase.class)
public interface MyBaseRequest extends RequestContext {
Request<MyBaseProxy> getStuff(); // MyChild1 here
}
...
Request<MyBaseProxy> getStuffRequest = request.getStuff();
getStuffRequest.fire(new Receiver<MyBaseProxy>() {
@Override
public void onSuccess(MyBaseProxy proxy) {
button.setText(((MyChild1Proxy)proxy).getQwerty()); // HERE!
}
});
?
问题是,我不能让它工作。要么还不支持,要么我需要在某处添加一些神奇的注释。当我使用具体类型时,一切都很好,但如果我使用基本类型,它就不起作用了。你觉得怎么样?
修复@ExtraTypes
:
@Service(ArticleBase.class)
@ExtraTypes({MyChild1Proxy.class, MyChild2Proxy.class})
public interface MyBaseRequest extends RequestContext {
Request<MyBaseProxy> getStuff(); // MyChild1 here
}