code: public void setProperty(Object object, Object newValue) {
          MetaMethod setter = getSetter();
          if (setter == null) {
              if (field != null && !Modifier.isFinal(field.getModifiers())) {
                  field.setProperty(object, newValue);
                  return;
              }
              throw new GroovyRuntimeException("Cannot set read-only property: " + name);
          }
          newValue = DefaultTypeTransformation.castToType(newValue, getType());
          setter.invoke(object, new Object[]{newValue});
      }
docs: Set the property on the given object to the new value.
  
  @param object   on which to set the property
  @param newValue the new value of the property
  @throws RuntimeException if the property could not be set