将Map转换为Java Bean
//package com.nowjava; import java.beans.BeanInfo; import java.beans.IntrospectionException;/** 来 自 时代Java - nowjava.com**/ import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Map; public class Main { public static Object convertMap2Bean(Class type, Map map) throws IntrospectionException, IllegalAccessException, InstantiationException, InvocationTargetException {/*来 自 时 代 J a v a - N o w J a v a . c o m*/ BeanInfo beanInfo = Introspector.getBeanInfo(type); Object obj = type.newInstance(); PropertyDescriptor[] propertyDescriptors = beanInfo .getPropertyDescriptors(); for (PropertyDescriptor pro : propertyDescriptors) { String propertyName = pro.getName(); if (pro.getPropertyType().getName().equals("java.lang.Class")) { continue; }