add feature: 当byte反序列化成object时,使用tag查找属性
gaoxinge opened this issue · 1 comments
gaoxinge commented
如果定义的struct的属性不是以大写的英文开头,比如:
type TestObjectStruct struct {
_value int
}
func (*TestObjectStruct) JavaClassName() string {
return "com.caucho.hessian.test.TestObject"
}
那么在反序列化的时候,可能会遇到值绑定不上属性的情形:
https://github.com/dubbogo/hessian2/blob/develop/object.go#L299-L301
所以是不是可以使用tag查找属性,然后把值绑定到属性上:
type TestObjectStruct struct {
Value int `hessian:"_value"`
}
func (*TestObjectStruct) JavaClassName() string {
return "com.caucho.hessian.test.TestObject"
}
AlexStocks commented
That is a good idea. If there is a tag for a struct member, we enc/dec by its tag name firstly.