T obj = beanType.newInstance();
BeanInfo beanInfo = Introspector.getBeanInfo(beanType,Object.class);
PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor pd:pds) {
String propertyName = pd.getName();//属性名
String propertyValue = beanMap.get(propertyName);//属性值
if(StringUtils.isNotEmpty(propertyValue)){
Class<?> propertyType = pd.getPropertyType();
String simpleName = propertyType.getSimpleName();
Method writeMethod = pd.getWriteMethod();
System.out.println(writeMethod.getName());
}
}
获取到的method是null,但是获取get方法可以获取到。
求大神指点
项目:JFinal