eEricZeng / gitalk

gitalk plugin repo
https://eericzeng.github.io
Apache License 2.0
0 stars 0 forks source link

BeanUtils拷贝Map、JSONObject中的枚举、POJO属性 | EricZeng #19

Open eEricZeng opened 4 years ago

eEricZeng commented 4 years ago

https://eericzeng.github.io/2019/08/26/BeanUtils%E6%8B%B7%E8%B4%9DMap%E3%80%81JSONObject%E4%B8%AD%E7%9A%84%E6%9E%9A%E4%B8%BE%E3%80%81POJO%E5%B1%9E%E6%80%A7/

版本说明 commons-beanutils:1.9.3 fastjson:1.2.58 场景使用BeanUtils.copyProperties()拷贝Map/JSONObject时,无法正常拷贝属性类型为枚举或POJO。此时,需要使用ConvertUtils注册一个自定义的转换类。 实验实验准备: Student类(拷贝对象),Student中有三个属性name/sex/grade分别为St