public static Object convertBenaToBena(Object from,Object to){
try {
BeanInfo beanInfo = Introspector.getBeanInfo(to.getClass());
PropertyDescriptor[] ps = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor p : ps) {
Method getMethod = p.getReadMethod();
Method setMethod = p.getWriteMethod();
try {
if (getMethod != null && setMethod != null) {
Object value = getMethod.invoke(from);
setMethod.invoke(to, value);
}
} catch (Exception e) {
System.err.println("请写get与set方法");
continue;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return to;
}