code: public void setField(Object o, String fieldName, Object newValue) {
          if (o == null) {
              throw new IllegalArgumentException("No object to set on provided");
          }
          Field field = findField(o, fieldName);
          if (field == null) {
              throw new IllegalArgumentException(o.getClass() + " does not have a field " + fieldName);
          } else {
              if (!field.isAccessible()) {
                  field.setAccessible(true);
              }
              try {
                  field.set(o, newValue);
              } catch (IllegalAccessException e) {
                  throw new IllegalArgumentException("Unable to set " + newValue + " for " + fieldName, e);
              }
          }
      }
docs: Sets (private) field of o (the field may be defined by o's class, or one of its superclasses).
  
  @param o         instance to set field of.
  @param fieldName name of field.
  @param newValue  value to set.