问题描述:在进行枚举类型转与Json之间的转换的时候报警告信息。 解决方法:Map<String, Object> classMap = new HashMap<String, Object>(); <span style="color:#FF6600;"><strong>JSONUtils.getMorpherRegistry().registerMorpher(new EnumMorpher(DispatchDirectory.class));</strong></span> classMap.put("dispatchDirectory", DispatchDirectory.class); ...... (Directory)JSONObject.toBean(jsonObj,Directory.class,classMap);
警告: Can't transform property 'dispatchDirectory' from java.lang.String into com.bh.entity.DispatchDi
本文介绍了一种解决枚举类型与Json之间转换时出现警告信息的方法。通过使用JSONUtils的getMorpherRegistry方法注册枚举转换器,实现枚举类型到Json的正确转换。

被折叠的 条评论
为什么被折叠?



