gpt4 book ai didi

java - GWT 2.4.0 RequestFactory 多态性

转载 作者:搜寻专家 更新时间:2023-10-31 19:30:26 24 4
gpt4 key购买 nike

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
}

关于java - GWT 2.4.0 RequestFactory 多态性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7625692/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com