JavaBean转Map方法
Map<String, Object> fieldMap =new HashMap<String, Object>(); BeanInfo beanInfo = Introspector.getBeanInfo(【javabean类名】.class, Object.class); //获取所有的属性描述器 PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for(PropertyDescriptor pd:pds){ String key = pd.getName(); Method getter = pd.getReadMethod(); Object value = getter.invoke(【实例化的javaBean】); fieldMap.put(key, value); }