| | |
| | | * @return Map对象 |
| | | * @version 2016年3月20日 11:03:01 |
| | | */ |
| | | public static Map convertBean2Map(Object bean) throws Exception { |
| | | public static Map convertBean2Map(Object bean,Set<String> existFild) throws Exception { |
| | | Class type = bean.getClass(); |
| | | Map returnMap = new HashMap(); |
| | | BeanInfo beanInfo = Introspector.getBeanInfo(type); |
| | |
| | | |
| | | if (result != null) { |
| | | if ("data".equals(propertyName)){ |
| | | returnMap.putAll((Map) result); |
| | | if(existFild == null){ |
| | | returnMap.putAll((Map) result); |
| | | }else{ |
| | | Map resulMap = (Map) result; |
| | | for (Object o : resulMap.keySet()) { |
| | | if(existFild.contains(o)){ |
| | | returnMap.put(o,resulMap.get(o)); |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | returnMap.put(fieldMap.containsKey(propertyName)?fieldMap.get(propertyName):propertyName, result); |
| | | } |