importjava.beans.IntrospectionException;importjava.beans.PropertyDescriptor;importjava.lang.reflect.Field;importjava.lang.reflect.Method;public classPropertyUtil {private static final String SET_PREFIX = "set";private static final String IS_PREFIX = "is";private static final String GET_PREFIX = "get";public static PropertyDescriptor getPropertyDescriptor(Class> clazz, String propertyName) {//根据需求,定制 自己的get和set方法
Method setMethod = null;
Method getMethod= null;
PropertyDescriptor pd= null;try{
Field field= clazz.getDeclaredField(propertyName);//根据字段名来获取字段
if (field != null) {//构建方法的后缀
String methodEnd = propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
setMethod= clazz.getDeclaredMethod(SET_PREFIX + methodEnd, newClass[] { field.getType() });//构建get 方法
getMethod = cla