wuxw
2019-05-22 7fb4b60a821241350e9285c7ad397b783fdcb94c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.java110.common.util;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.dto.CommunityMemberDto;
import junit.framework.TestCase;
import org.apache.commons.beanutils.BeanUtils;
 
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
 
public class BeanConvertUtilTest extends TestCase {
 
    public void testCovertBean() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
 
        CommunityMemberDto communityMemberDto = new CommunityMemberDto();
        communityMemberDto.setMemberTypeCd("123");
        communityMemberDto.setStatusCd("1");
        communityMemberDto.setMemberId("123123");
 
        Map info = new HashMap();
 
        //Map _info  = BeanConvertUtil.beanCovertMap(communityMemberDto);
        Map _info  = BeanUtils.describe(communityMemberDto);
 
        System.out.println(JSONObject.toJSONString(_info));
    }
}