private Object getObject(String param, PrintStream os) { Object o = getObject(Object.class, param); os.println("Object found, class " + o.getClass().getCanonicalName()); if (ArrayUtils.contains(baseList, o.getClass())) { os.println("Value : " + o.toString()); } return o; }
private void printGetter(Object o, Class<?> clazz, PrintStream os) { for (Method m : clazz.getDeclaredMethods()) { if (m.getName().startsWith("get")) { os.print("Getter [" + clazz.getSimpleName() + "] " + m.getName()); if (ArrayUtils.contains(baseList, m.getReturnType()) && m.getParameterTypes().length == 0) { try { Object res = m.invoke(o); os.print(", value " + res); } catch (Throwable e) { } } os.println(); } } for (Field f : clazz.getDeclaredFields()) { if (!Modifier.isStatic(f.getModifiers()) && !Modifier.isFinal(f.getModifiers())) { os.print( "Field [" + clazz.getSimpleName() + "] [" + f.getClass().getSimpleName() + "] " + f.getName()); if (ArrayUtils.contains(baseList, f.getType())) { try { Object res = f.get(o); os.print(", value " + res); } catch (Throwable e) { } } os.println(); } } if (clazz.getSuperclass() != null) { printGetter(o, clazz.getSuperclass(), os); } }