Java Code Examples for org.springframework.cglib.beans.BeanMap#keySet()

The following examples show how to use org.springframework.cglib.beans.BeanMap#keySet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BeanMapUtils.java    From we-cmdb with Apache License 2.0 5 votes vote down vote up
public static <T> Map<String, Object> convertBeanToMap(T bean) {
    Map<String, Object> map = Maps.newHashMap();
    if (bean != null) {
        BeanMap beanMap = BeanMap.create(bean);
        for (Object key : beanMap.keySet()) {
            if (beanMap.get(key) != null) {
                map.put(key.toString(), beanMap.get(key));
            }
        }
    }
    return map;
}
 
Example 2
Source File: ObjectUtil.java    From SENS with GNU General Public License v3.0 5 votes vote down vote up
public static <T> Map<String, Object> beanToMap(T bean) {
    Map<String, Object> map = Maps.newHashMap();
    if (bean != null) {
        BeanMap beanMap = BeanMap.create(bean);
        for (Object key : beanMap.keySet()) {
            map.put(key+"", beanMap.get(key));
        }
    }
    return map;
}
 
Example 3
Source File: WarningHelper.java    From seppb with MIT License 5 votes vote down vote up
default Map<String, Object> beanToMap(@NonNull T t) {
    Map<String, Object> defectMap = Maps.newHashMap();
    BeanMap beanMap = BeanMap.create(t);
    for (Object key : beanMap.keySet()) {
        Object value = valueToDouble(null == beanMap.get(key) ? 0.0001 : beanMap.get(key));
        defectMap.put(String.valueOf(key), value);
    }
    return defectMap;
}
 
Example 4
Source File: AuditUtil.java    From pmq with Apache License 2.0 5 votes vote down vote up
public static Map<String, String> convertMap(Object source) {
    if (source== null) {
        return new HashMap<>();
    }
    BeanMap sourceBeanMap = BeanMap.create(source);
    Map<String, String> sourceFieldMap = new HashMap<>();
    for (Object key: sourceBeanMap.keySet()) {
        sourceFieldMap.put(key.toString(), JsonUtil.toJson(sourceBeanMap.get(key)));
    }
    return sourceFieldMap;
}
 
Example 5
Source File: BeanUtil.java    From web-flash with MIT License 5 votes vote down vote up
/**
* 将对象装换为map
* @param bean
* @return
        */
public static <T> Map<String, Object> beanToMap(T bean) {
    Map<String, Object> map = Maps.newHashMap();
    if (bean != null) {
        BeanMap beanMap = BeanMap.create(bean);
        for (Object key : beanMap.keySet()) {
            map.put(key+"", beanMap.get(key));
        }
    }
    return map;
}
 
Example 6
Source File: BeanUtil.java    From flash-waimai with MIT License 5 votes vote down vote up
/**
* 将对象装换为map
* @param bean
* @return
        */
public static <T> Map<String, Object> beanToMap(T bean) {
    Map<String, Object> map = Maps.newHashMap();
    if (bean != null) {
        BeanMap beanMap = BeanMap.create(bean);
        for (Object key : beanMap.keySet()) {
            map.put(key+"", beanMap.get(key));
        }
    }
    return map;
}
 
Example 7
Source File: BeanMapUtils.java    From Lottor with MIT License 5 votes vote down vote up
/**
 * 将对象装换为map
 *
 * @param bean
 * @return
 */
public static <T> Map<String, Object> beanToMap(T bean) {
    Map<String, Object> map = Maps.newHashMap();
    if (bean != null) {
        BeanMap beanMap = BeanMap.create(bean);
        for (Object key : beanMap.keySet()) {
            if (Objects.nonNull(beanMap.get(key))) {
                map.put(key + "", beanMap.get(key));
            }

        }
    }
    return map;
}
 
Example 8
Source File: Utils.java    From faster-framework-project with Apache License 2.0 5 votes vote down vote up
/**
 * bean转map
 *
 * @param bean 原始bean
 * @param <T>  泛型
 * @return map
 */
public static <T> Map<String, Object> beanToMap(T bean) {
    Map<String, Object> map = new HashMap<>();
    if (bean != null) {
        BeanMap beanMap = BeanMap.create(bean);
        for (Object key : beanMap.keySet()) {
            map.put(key + "", beanMap.get(key));
        }
    }
    return map;
}
 
Example 9
Source File: BeanConvertUtil.java    From MicroCommunity with Apache License 2.0 5 votes vote down vote up
/**
 * bean转换为map对象
 *
 * @param orgBean 原始bean
 * @return map对象
 */
public static Map beanCovertMap(Object orgBean) {

    Map<String, Object> map = new HashMap();
    try {
        BeanMap beanMap = BeanMap.create(orgBean);
        for (Object key : beanMap.keySet()) {
            map.put(key + "", beanMap.get(key));
        }
    } catch (Exception e) {
        throw new RuntimeException("bean转换Map失败", e);
    }
    return map;
}