今天遇到一个问题,自定义的对象中有整型类型,而这个整型类型是自定义的,继承了Integer,如下所示:
Person.java
package com.xxx.huali.hualitest.json;
public class Person {
public ID id;
public String name;
public Person child;
public Person() {
}
public Person(ID id,String name) {
this.id = id;
this.name = name;
}
public Person(ID id,String name,Person child) {
this(id, name);
this.child = child;
}
}
ID.java
package com.xxx.huali.hualitest.json;
public class ID {
public Integer value ;
public ID() {
}
public ID(int value) {
this.value = value;
}
@Override
public String toString() {
return ""+value;
}
}
JsonTest.java
package com.xxx.huali.hualitest.json;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.ValueFilter;
public class JsonTes