Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gwt 接口/抽象类的带有ValueType的RequestFactory_Gwt_Requestfactory - Fatal编程技术网

Gwt 接口/抽象类的带有ValueType的RequestFactory

Gwt 接口/抽象类的带有ValueType的RequestFactory,gwt,requestfactory,Gwt,Requestfactory,以下是我的域类 class Person { String getName(); Vehicle getVehicle(); } interface Vehicle { String getCompanyName(); String getRegNo(); Point getParkingSpaceRequired(); } abstract class AbstractVehicle { } class Motorcycle e

以下是我的域类

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$$EnhancerByGlib$$e86549b9发送到客户端

论人格代理 我得到了@ProxyForvalue=Person.class,locator=PersonLocator.class 在VehicleProxy上,我得到@ProxyForvalue=Vehicle.class

那么,如何在RequestFactory中处理这种继承呢? 我是否应该将车辆从ValueProxy更改为EntityProxy?
那么如何实现车载定位仪的方法呢

您应该为Motorcycle和Car编写代理接口,而不是为interface Vehicle编写代理接口。我从未将requestfactory代理接口用于接口而不是类,我认为这就是为什么会出现这种异常

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


我认为可能不起作用的另一个解决方案是为Vehicle接口编写代理接口,MotorOccle和Car的代理接口应该扩展它。

那么PersonProxy的getVehicle应该返回什么呢?交通工具和MotorkeProxy应该扩展车辆接口?或者我应该使用车载Proxy?对,我错过了这部分-抱歉。请看一下我的编辑。