Object类型和实体类简单的相互转化
用到的中间工具类型 net.sf.json.JSONObject
//建立一个对象并将 给对象赋值
Student stu = new Student();
stu.setId(1);
stu.setName("张三");
1.实体类转Object
JSONObject json = JSONObject.fromObject(stu);
Object obj = JSONObject.toBean(json,Student.class);
2.Object转实体类
JSONObjec..
原创
2021-09-14 19:35:56 ·
6782 阅读 ·
1 评论