code: public static void setFieldValue(final Object object, final String fieldName, final Object value) {
  
          final boolean success = new DerivedClassIterator(object.getClass()) {
  
              @Override
              protected boolean handleClass(final Class<?> clazz) {
                  try {
                      setFieldValue(object, clazz, fieldName, value);
                      return true;
                  } catch (final NoSuchFieldException e) {
                      LOG.debug("could not set field " + fieldName + " value " + value, e);
  
                  }
                  return false;
              }
          }.iterate();
  
          if (!success) {
              LOG.warn("could not set field " + fieldName + " value " + value);
          }
      }
docs: Changing the value of a given field.
  
  @param object
  -- target object of injection
  @param fieldName
  -- name of field whose value is to be set
  @param value
  -- object that is injected