关于MAP转换成驼峰命名法然后转换成实体


import org.apache.commons.beanutils.BeanUtils;

 

public static Map<String, Object> toReplaceKeyLow(Map<String, Object> map) {
        Map re_map = new HashMap();
        if(re_map != null) {
            Iterator var2 = map.entrySet().iterator();

            while(var2.hasNext()) {
                Entry<String, Object> entry = (Entry)var2.next();
                re_map.put(underlineToCamel((String)entry.getKey()), map.get(entry.getKey()));
            }

            map.clear();
        }

        return re_map;
    }

MAP 调用 toReplaceKeyLow 方法

//将获取到的Map值转换成驼峰命名法
        Map bankMap = CommTool.toReplaceKeyLow(toobtain);

//将MAP转换成实体
                        PreTiedCardBo preTiedCardBo = new PreTiedCardBo();
                        BeanUtils.populate(preTiedCardBo, bankMap);    

  

posted @ 2017-05-05 13:51  夜天晰  阅读(3696)  评论(0编辑  收藏  举报