예제 #1
0
 protected Object getField(Object o, Class<?> clazz, String name) {
   try {
     Field f = clazz.getDeclaredField(name);
     boolean prev = f.isAccessible();
     f.setAccessible(true);
     try {
       return f.get(o);
     } finally {
       f.setAccessible(prev);
     }
   } catch (ReflectiveOperationException e) {
     return e;
   } catch (SecurityException e) {
     return e;
   }
 }
예제 #2
0
 protected Object callMethod(Object o, Class<?> clazz, String name) {
   try {
     Method m = clazz.getDeclaredMethod(name);
     boolean prev = m.isAccessible();
     m.setAccessible(true);
     try {
       return m.invoke(o);
     } finally {
       m.setAccessible(prev);
     }
   } catch (ReflectiveOperationException e) {
     return e;
   } catch (SecurityException e) {
     return e;
   }
 }
예제 #3
0
 protected String info(Class<?> clazz, Object internal, Object external) {
   return String.format("%s,%s,%s", clazz.getSimpleName(), internal, external);
 }