Best way of invoking getter by reflection
I think this should point you towards the right direction: import java.beans.* for (PropertyDescriptor pd : Introspector.getBeanInfo(Foo.class).getPropertyDescriptors()) { if (pd.getReadMethod() != null && !”class”.equals(pd.getName())) System.out.println(pd.getReadMethod().invoke(foo)); } Note that you could create BeanInfo or PropertyDescriptor instances yourself, i.e. without using Introspector. However, Introspector does some caching internally which is normally a Good Thing ™. If you’re … Read more