Ejemplo n.º 1
0
 /**
  * 通过反射的方式遍历对象的属性和属性值,方便调试
  *
  * @param o 要遍历的对象
  * @throws Exception
  */
 public static void reflect(Object o) throws Exception {
   Class cls = o.getClass();
   Field[] fields = cls.getDeclaredFields();
   for (int i = 0; i < fields.length; i++) {
     Field f = fields[i];
     f.setAccessible(true);
     Util.log(f.getName() + " -> " + f.get(o));
   }
 }