0

以下是我的域类

class Person { 
     String getName(); 
     Vehicle getVehicle(); 
} 

interface Vehicle { 
   String getCompanyName(); 
   String getRegNo(); 
   Point getParkingSpaceRequired(); 
} 

abstract class AbstractVehicle { 
} 

class Motorcycle extends AbstractVehicle { 
} 

class Car extends AbstractVehicle { 
} 

将 PersonProxy 创建为 EntityProxy 很简单,并且适用于 person.getName()

我已经将 VehicleProxy 创建为 ValueProxy 并使用 .with('vehicle') 调用了 fire() 但我收到错误消息:

域类型 com....AbstractVehicle$$EnhancerByCGLIB$$e86549b9 无法发送给客户端。

在 PersonProxy 我得到 @ProxyFor(value=Person.class,locator=PersonLocator.class)
在 VehicleProxy 我得到 @ProxyFor(value=Vehicle.class)

那么,如何在 RequestFactory 中处理这种继承?
我应该将 Vehicle 从 ValueProxy 更改为 EntityProxy 吗?
那么如何实现 VehicleLocator 的方法呢?

4

1 回答 1

0

您应该为 interface 编写代理接口MotorocycleCar不是代理接口Vehicle。我从来没有为接口(不是类)使用 requestfactory 代理接口,在我看来这就是你得到这个异常的原因。

[编辑]
在上述情况下,您必须将Vehicle界面移动到shared包中,以便服务器和客户端站点都能看到它。这是枚举情况下非常常见的解决方案 - 域类具有一些枚举属性,代理接口还必须包含该属性的访问器。

其他解决方案(我认为可能行不通)是为Vehicle接口和代理接口编写代理接口,Motorocycle并且Car应该扩展它。

于 2011-08-08T16:25:12.490 回答