[英]GWT 2.4.0 RequestFactory polymorphism
Does GWT 2.4 support this case: 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!
}
});
? ?
The problem is, I can't make it work. 问题是,我无法使其发挥作用。 It's either not supported yet or I need to add some magic annotation somewhere.
它要么不支持,要么我需要在某处添加一些魔法注释。 Everything works fine when I use concrete types, but it doesn't work if I use the base ones.
当我使用具体类型时,一切正常,但如果我使用基本类型,它就不起作用。
What do you think? 你怎么看?
Fixed it with @ExtraTypes
: 使用
@ExtraTypes
修复它:
@Service(ArticleBase.class)
@ExtraTypes({MyChild1Proxy.class, MyChild2Proxy.class})
public interface MyBaseRequest extends RequestContext {
Request<MyBaseProxy> getStuff(); // MyChild1 here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.