【问题标题】:GWT Requestfactory: EntityProxy containing List of "InterfaceProxy"GWT Requestfactory:EntityProxy 包含“InterfaceProxy”列表
【发布时间】:2014-07-26 17:01:56
【问题描述】:

想象一下使用 GWT、RequestFactory 和 JPA 时的以下情况。
服务器端:

@Entity
public class SuperEmployee implements IsEmployee {...}

@Entity
public class BadEmployee implements IsEmployee {...}

@Entity
public class Supervisor {
List<IsEmployee> employees;
...
}

客户端代理:

@ProxyFor(value = Supervisor.class, ...)
public interface SupervisorProxy {...}

现在我想要类似的东西:

@ProxyFor(value = IsEmployee.class, ...)
public interface EmployeerProxy {...}

当然这是行不通的,但是如果我对客户端的具体类型不感兴趣并且只想使用接口方法,那么解决方案是什么。

我已阅读以下可能有帮助的文章(但也许我没有理解正确的观点): http://www.gwtproject.org/doc/latest/DevGuideRequestFactory.html(“可传输类型”部分)。

感谢您启发我的 Requestfactory 知识!
拉尔夫

【问题讨论】:

    标签: java gwt requestfactory


    【解决方案1】:

    GWT 不 (yet) 支持 @ProxyFor 指向接口。不过,这将在 2.7 中成为可能。

    同时,您必须在服务器端使用基类,或在客户端使用接口层次结构(如果不直接使用,可能@ExtraTypes 指向特定接口) )

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-22
      • 2019-04-19
      • 2017-03-25
      • 1970-01-01
      相关资源
      最近更新 更多