Open wsjz opened 5 years ago
class Father{ String type; String getType(); }
class Child extends Father{ String type; String getType(){ return type; } }
Father var = new Child().setType("Child");
类似这种情况,反序列化之后的父类调用了getType()方法后能得到子类方法返回的结果吗?
用于子类属性,pb序列化必须 要指定到子类才可以
怎么指定子类呢
ProtobufProxy.create(子类.class);
目前我使用的场景:使用Request类,该类里放了父类,但是对Request在服务端反序列化后只能拿到父类的信息,子类的信息没了。。。
class Father{ String type; String getType(); }
class Child extends Father{ String type; String getType(){ return type; } }
Father var = new Child().setType("Child");
类似这种情况,反序列化之后的父类调用了getType()方法后能得到子类方法返回的结果吗?