码迷,mamicode.com
首页 > 其他好文 > 详细

hutool-all 包把实体Bean转化成字符串,以及把字符串转化成Bean对象

时间:2019-09-18 11:31:35      阅读:705      评论:0      收藏:0      [点我收藏+]

标签:tst   back   out   输出   job   lse   equals   span   entity   

GxyJobEntity gxyJobEntity1  = new GxyJobEntity();
        gxyJobEntity1.setUserId("user001");
        gxyJobEntity1.setPlanId("plan001");
        gxyJobEntity1.setStudentId("stu001");
        
        System.out.println(gxyJobEntity1);
        
        String str = JSONUtil.toJsonStr(gxyJobEntity1);
        System.out.println(str);
        
        GxyJobEntity studentEntity= JSONUtil.toBean(str,GxyJobEntity.class);
        System.out.println(studentEntity);
        
        System.out.println(gxyJobEntity1.equals(studentEntity));

输出:

GxyJobEntity [jobId=null, studentId=stu001, planId=plan001, userId=user001]
{"studentId":"stu001","planId":"plan001","userId":"user001"}
GxyJobEntity [jobId=null, studentId=stu001, planId=plan001, userId=user001]
false

hutool-all 包把实体Bean转化成字符串,以及把字符串转化成Bean对象

标签:tst   back   out   输出   job   lse   equals   span   entity   

原文地址:https://www.cnblogs.com/z360519549/p/11540006.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!