Skip to content

add feature: 当byte反序列化成object时,使用tag查找属性 #19

@gaoxinge

Description

@gaoxinge

如果定义的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"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions