The examples are as follows:
package com.ljq.util;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Map工具类
*
* @author jqlin
*/
public class MapUtils {
/**
* 从map集合中获取属性值
*
* @param
* @param map
* map集合
* @param key
* 键对
* @param defaultValue
* 默认值
* @return
* @author jiqinlin
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public final static E get(Map map, Object key, E defaultValue) {
Object o = map.get(key);
if (o == null)
return defaultValue;
return (E) o;
}
/**
* Map集合对象转化成 JavaBean集合对象
*
* @param javaBean JavaBean实例对象
* @param mapList Map数据集对象
* @return
* @author jqlin
*/
@SuppressWarnings({ "rawtypes" })
public static List map2Java(T javaBean, List
The above is the entire method of converting encapsulated classes between JavaBean and Map brought to you by the editor. I hope everyone will support the PHP Chinese website~
More For articles related to methods of converting JavaBean and Map encapsulated classes, please pay attention to the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn