getDeclaredField(String) vs. getMethod(String) for private fields in a bean
I have a bean whose properties I want to access via reflection. I receive the property names in String form. The beans have getter methods for their private fields. I am currently getting the field using getDeclaredField(fieldName), making it accessible by using setAccessible(true) and then retrieving its value using get. Another way t...