Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

1.2.11版本无法解析父类的属性? #633

Closed
goduun opened this issue May 16, 2016 · 5 comments
Closed

1.2.11版本无法解析父类的属性? #633

goduun opened this issue May 16, 2016 · 5 comments
Milestone

Comments

@goduun
Copy link

goduun commented May 16, 2016

public class A {
    private String a;

    a getter/setter
}

public class B extends A {
    private String b;

    b getter/setter
}

jsonStr = {"a": "a-value", "b": "b-value"};
B b = JSON.parseObject(jsonStr, B.class);
b.getA()为null
@wenshao
Copy link
Member

wenshao commented May 16, 2016

原因是没有public Field或者public Setter吧

@goduun
Copy link
Author

goduun commented May 16, 2016

知道原因了,父类不是标准的javabean,使用了流式setter:

public A setA(String a) {
this.a = a;
return this;
}

@wenshao
Copy link
Member

wenshao commented May 17, 2016

这是一个问题,下个版本1.2.12版本将会支持

@wenshao wenshao added this to the 1.2.12 milestone May 17, 2016
@wenshao wenshao closed this as completed May 17, 2016
@summer9989
Copy link

@wenshao 请问流式setter 在1.2.12+的版本如何使用呢? 默认启用了吗? 我甚至用了最新的1.2.49版本,默认依旧不能自动转换呢

@wenshao
Copy link
Member

wenshao commented May 11, 2018

@summer9989 请提供重现问题的testcase

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants