当要串行化的继承自BaseModelData的实体对象在RPC调用串行化的过程中会发生错误,原因是因为Java的虚假泛型机制导致,虽然我们声明的是泛型集合,但是虚拟机并不知道集合中是什么类型以及是否可以被序列化。解决的方法是声明一个无需实现的接口,目的就是告诉RPC这种类型可以序列化,示例如下:
@RemoteServiceRelativePath("activityRpcServices.gwt")
public interface ActivityRpcService extends RemoteService {
begin dummy methods, only signature is needed(especially with their return type).
ActivityInfo declareActivityInfo(ActivityInfo a);
end dummy methods.
}
这个方法就是为了告诉gwt编译器,我需要在网络上串行化传输这种对象,需要生成那个印戳.本身不需要实现.
@RemoteServiceRelativePath("activityRpcServices.gwt")
public interface ActivityRpcService extends RemoteService {
begin dummy methods, only signature is needed(especially with their return type).
ActivityInfo declareActivityInfo(ActivityInfo a);
end dummy methods.
}
这个方法就是为了告诉gwt编译器,我需要在网络上串行化传输这种对象,需要生成那个印戳.本身不需要实现.