code: public static Object getValue(Object instance, String name) {
          assert instance != null;
          assert name != null;
          try {
              Class<?> clazz = instance.getClass();
              Object value = null;
              Method property = findProperty(clazz, name);
              if (property != null) {
              	value = property.invoke(instance);
              }
              else {
                  Field field = findField(clazz, name);
                  if (field != null) {
                      value = field.get(instance);
                  }
              }
              log.debug("Value for field/property '{}' is: '{}'", name, value);
              return value;
          }
          catch (Exception e) {
              log.error("Could not get a value for field/property '" + name + "'", e);
              return null;
          }
      }
docs: tries to get the value from a field or a getter property for a given object instance
  
  @param instance the object instance
  @param name name of the property or field
  @return
  @throws IllegalArgumentException
  @throws IllegalAccessException
  @throws InvocationTargetException