调用Setter方法, 无视private/protected修饰符, 按传入value的类型匹配函数.

性能较差, 用于单次调用的场景
491787
public static void invokeSetter(Object obj, String propertyName, Object value) {
		Method method = getSetterMethod(obj.getClass(), propertyName, value.getClass());
		if (method == null) {
			throw new IllegalArgumentException(
					"Could not find getter method [" + propertyName + "] on target [" + obj + ']');
		}
		invokeMethod(obj, method, value);
	}
776840
function setValue(object, key, value) {
  if (key in object === true) return;
  object[key] = value;
}
293418
function definePropertyHolder(object) {
                let holder = defaultValue;

                Object.defineProperty(object, id, {
                    enumerable: false,
                    configurable: true,
                    get: function getterWrapper() {
                        if (checkIfWrapped(getterWrapper.caller)) {
                            return holder;
                        }
                        throw new ReferenceError(`Access violation for private property: 
                            ${id}`);
                    },
                    set: function setterWrapper(value) {
                        if (checkIfWrapped(setterWrapper.caller)) {
                            holder = value;
                        } else {
                            throw new ReferenceError(`Access violation for private property:
                                 ${id}`);
                        }
                    }
                });
                propertyHolderDefined = true;
            }
678142
public void set(Object object, Object value) throws IllegalAccessException, IllegalArgumentException {
        if (null != setter) {
            try {
                setter.invoke(object, value);
            } catch (InvocationTargetException ite) {
                if (ite.getCause() instanceof RuntimeException && !(ite.getCause() instanceof JTransfoException)) {
                    throw (RuntimeException) ite.getCause();
                }
                throw new JTransfoException(String.format(GET_SET_ITO, setter.getName(), object.getClass().getName(),
                        setter.getDeclaringClass().getName(), ite.getCause().getMessage()), ite.getCause());
            }
        } else {
            if (!setUsingFieldLogged) {
                log.warn("Cannot find setter (not public, wrong name or wrong type), "
                                + "using field to access field {} of {}.", name, field.getType().getName());
                setUsingFieldLogged = true;
            }
            field.set(object, value);
        }
    }
1356332
public static void setFieldValue(Object obj, Field field, Object value) throws UtilException {
		Assert.notNull(obj);
		Assert.notNull(field);
		field.setAccessible(true);
		
		if(null != value) {
			Class<?> fieldType = field.getType();
			if(false == fieldType.isAssignableFrom(value.getClass())) {
				//对于类型不同的字段，尝试转换，转换失败则使用原对象类型
				final Object targetValue = Convert.convert(fieldType, value);
				if(null != targetValue) {
					value = targetValue;
				}
			}
		}
		
		try {
			field.set(obj, value);
		} catch (IllegalAccessException e) {
			throw new UtilException(e, "IllegalAccess for {}.{}", obj.getClass(), field.getName());
		}
	}
160827
@Override
    public Object setE(int key, Object value) throws ExpressionException {
	if (offset + key > arr.length) enlargeCapacity(key);
	if (key > size) size = key;
	arr[(offset + key) - 1] = checkValue(value);
	return value;
    }
237386
function setValue(descriptor,key,set,update)
        {
          var _descriptor = descriptor,
              _key = key,
              _set = set,
              _update = update,
              _oldValue;
          return function valueSet(v)
          {
            _oldValue = _descriptor.value;
            if(_set(this,_key,v,_oldValue,arguments,this._stopChange))
            {
              _descriptor.value = v;
            }
            if(!this._stopChange)
            {
              _update(this,_key,v,_oldValue,arguments);
            }
            this._stopChange = undefined;
          }
        }
4478
@Override
    public void set(Object value)
    {
        try
        {
            Object v = ConvertUtility.convert(type, value);
            if (field != null)
            {
                field.set(getBase(), v);
            }
            else
            {
                setter.invoke(getBase(), v);
            }
        }
        catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex)
        {
            throw new IllegalArgumentException(ex);
        }
    }
140788
@Override
    public Object setEL(PageContext pc, Collection.Key name, Object value) {
	try {
	    return set(pc, name, value);
	}
	catch (PageException e) {
	    return null;
	}
    }
319329
public void executeSetValue(Object pvObject, Object pvArgs) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
		AccessController.doPrivileged(new AccessiblePrivilegedAction(accessibleObject));
		if (propertyType == PROPERTY_TYPE_METHOD) {
			((Method) accessibleObject).invoke(pvObject, new Object[] { pvArgs });	
		} else {
			((Field) accessibleObject).set(pvObject, pvArgs);
		}
	}
587281
def set(self, value):
        '''
        
        '''
        with self._reference.get_lock():
            self._reference.value = value
            return value
438617
function set(prefix, value) {
    for (const key of keys(value)) {
      const name = prefix ? `${prefix}[${key}]` : key
      const field = value[key]

      if (isArray(field) || isPlainObject(field)) {
        set(name, field)
      } else {
        if (options.strict && (isBoolean(field) && field === false)) {
          continue
        }

        fd[method](name, field)
      }
    }
  }
542500
private static void setValue(Object obj, String propertyPattern, Object value, ObjectWrapper options) {
        if (propertyPattern == null) {
            throw new IllegalArgumentException("Cannot set a new value to a property with a 'null' propertyPattern.");
        }

        if (obj == null) {
            // NullPointerException as it is throwed only when traversing a null object (ex: "foo.null.bar")
            throw new NullPointerException("Cannot set the value of '" + propertyPattern + "' to a 'null' object.");
        }

        // '.' position if positive, '[' inverse position if negative
        int position = indexOfDotOrSquare(propertyPattern);

        // (propertyPattern.contains("."))
        if (position > 0) {
            String leftPattern = propertyPattern.substring(0, position);
            String rightPattern = propertyPattern.substring(position + 1, propertyPattern.length());
            Object leftValue = getValue(obj, leftPattern, options);

            if (leftValue == null) {
                Property leftProperty = getPropertyOrThrow(Bean.forClass(obj.getClass()), leftPattern);

                if (options.isAutoInstancing) {
                    try {
                        leftValue = leftProperty.getType().newInstance();
                    } catch (Exception e) {
                        throw new ReflectionException("The value of " + leftProperty + " was 'null' in the object "
                                                              + obj.getClass().getName() + ". An attempt to invoke its 'no-args constructor'" +
                                                              " was made, but an error occurs.", e);
                    }

                    leftProperty.set(obj, leftValue);
                }
            }

            setValue(leftValue, rightPattern, value, options);
            // if (propertyPattern.contains("["))
        } else if (position < 0) {
            int squarePosition = -position;

            String leftPattern = propertyPattern.substring(0, squarePosition);
            String indexOrKey = propertyPattern.substring(squarePosition + 1, propertyPattern.length() - 1);// removes ']'
            Property leftProperty = getPropertyOrThrow(Bean.forClass(obj.getClass()), leftPattern);

            if (leftProperty.getType().isAssignableFrom(Map.class)) {
                setMappedValue(obj, leftProperty, indexOrKey, value, options);
            } else {
                try {
                    setIndexedValue(obj, leftProperty, Integer.parseInt(indexOrKey), value, options);
                } catch (NumberFormatException e) {
                    throw new IllegalArgumentException("The pattern '" + indexOrKey + "' for the indexed "
                                                               + leftProperty + " is invalid. Cannot parse the string to a valid integer index.");
                }
            }
        } else {
            setSimpleValue(obj, getPropertyOrThrow(Bean.forClass(obj.getClass()), propertyPattern), value);
        }
    }
686402
public static boolean setField(Object object, String fieldName, Object value) {
		char c = fieldName.charAt(0);

		if (c >= 'a' && c <= 'z') {
			c -= 'a' - 'A';
			fieldName = c + fieldName.substring(1);
		}

		String methodName = "set" + fieldName;
		Class<?>[] returnType = new Class<?>[1];
		Class<?> objectClass = object.getClass();

		Method getMethod = getMethod(objectClass, "get" + fieldName);

		if (getMethod == null) {
			getMethod = getMethod(objectClass, "is" + fieldName);
		}

		if (getMethod == null) {
			return false;
		}

		returnType[0] = getMethod.getReturnType();

		return silentInvoke(object, methodName, returnType, value);
	}
583726
public void set(String propName, Object value) {
        if (propName.equals("method")) {
            setMethod(((String) value));
        }
        if (propName.equals("object")) {
            setObject(((String) value));
        }
        if (propName.equals("attribute")) {
            setAttribute(((String) value));
        }
    }
500411
function setter(obj, path, setValue, fullExp) {
   var element = path.split('.'),
      key;
   for (var i = 0; element.length > 1; i++) {
      key = ensureSafeMemberName(element.shift(), fullExp);
      var propertyObj = obj[key];
      if (!propertyObj) {
         propertyObj = {};
         obj[key] = propertyObj;
      }
      obj = propertyObj;
   }
   key = ensureSafeMemberName(element.shift(), fullExp);
   obj[key] = setValue;
   return setValue;
}
63621
public static void invokeSetterMethod(Object obj, String propertyName, Object value) {
		invokeSetterMethod(obj, propertyName, value, null);
	}