Set the target field value

@param name  field name
@param value field value
@return Reflector
@throws ReflectException
426730
public Reflector set(String name, Object value) throws ReflectException {
        try {
            Field field = field0(name);
            field.setAccessible(true);
            field.set(obj, unwrap(value));
            return this;
        } catch (Exception e) {
            throw new ReflectException(e);
        }
    }
491752
public void set(String name, Object value) {
        hashAttributes.put(name, value);

        if (plugin != null) {
            plugin.invalidate();
        }
    }
1049521
public function setField(string $name, $value, bool $filter = true)
    {
        if ($value instanceof AccessorInterface) {
            //In case of non scalar values filters must be bypassed (check accessor compatibility?)
            $this->fields[$name] = clone $value;

            return;
        }

        if (!$filter || (is_null($value) && $this->isNullable($name))) {
            //Bypassing all filters
            $this->fields[$name] = $value;

            return;
        }

        //Checking if field have accessor
        $accessor = $this->getMutator($name, self::MUTATOR_ACCESSOR);

        if (!empty($accessor)) {
            //Setting value thought associated accessor
            $this->setAccessed($accessor, $name, $value);
        } else {
            //Setting value thought setter filter (if any)
            $this->setMutated($name, $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);
	}
732659
public static <T> void setProperty(Object bean, String name, Class<T> clazz, T value) throws Exception {
        Method method = ReflectUtils.getPropertySetterMethod(bean.getClass(), name, clazz);
        if (method.isAccessible()) {
            method.invoke(bean, value);
        } else {
            try {
                method.setAccessible(true);
                method.invoke(bean, value);
            } finally {
                method.setAccessible(false);
            }
        }
    }
19675
private void setObjectToTargetField(String fieldname, Object value) throws Exception {
        Object toWrite = null;
        if (fieldname.contains(".")) {
            String path = StringUtils.substringBeforeLast(fieldname, ".");
            toWrite = getObjectValue(path, false);
        }
        if (toWrite == null && isTemporaryField(fieldname)) {
            String mapKey = StringUtils.substringAfter(fieldname, "#");
            mapKey = StringUtils.substringBefore(mapKey, ".");
            temporaryFields.put(mapKey, value);
            return;
        }
        String realFieldName = fieldname.contains(".") ? StringUtils.substringAfterLast(fieldname, ".") : fieldname;
        writeObjectToField(realFieldName, value, toWrite, target);
    }
1007305
@Override
    public void set(Instance<?> value) throws InvocationException {
        try {
            if (!field.isAccessible()) {
                field.setAccessible(true);
            }
            field.set(target, value);
        } catch (Exception e) {
            throw new InvocationException(e.getCause());
        }
    }
871242
public static void setField(Class<?> targetClass, Object target, String field, Object value) {
        try {
            Field classField = targetClass.getDeclaredField(field);

            AccessController.doPrivileged(
                    new SetFieldPrivilegedAction(classField, target, value));

        } catch (NoSuchFieldException e) {
            throw new TransfuseInjectionException(
                    "NoSuchFieldException Exception during field injection: " + field + " in " + target.getClass(), e);
        } catch (PrivilegedActionException e) {
            throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e);
        } catch (Exception e) {
            throw new TransfuseInjectionException("Exception during field injection", e);
        }
    }
287098
public void set(String name, String value) {
        getOverlay().setProperty(name, value);
        getProps().setProperty(name, value);
    }
367855
public Field getField( String name )
    {
        for (Field field : target.getFields())
        {
            if (compare( field.getName(), name )) return field;
        }
        return null;
    }
789349
public void setValue(String fieldName, String value) {
    int index = getFieldIndex(fieldName);
    assert(index != -1);
    values[index] = value;
  }
98970
@JsonAnySetter
    public void setOthers(String name, Object value) {
        if(name.startsWith("_")) {
            // Just be defensive
            throw new RuntimeException("This is a reserved field, and should not be treated as document content.");
        }
        this.others.put(name, value);
    }
1177630
public static void setFieldValue(Object instanceContainingField, String fieldName, Object fieldValue)
    {
        // Find the class containing the field to set
        Class<?> targetClass = instanceContainingField.getClass();
        while (targetClass != null) {
            for (Field field : targetClass.getDeclaredFields()) {
                if (field.getName().equalsIgnoreCase(fieldName)) {
                    try {
                        boolean isAccessible = field.isAccessible();
                        try {
                            field.setAccessible(true);
                            field.set(instanceContainingField, fieldValue);
                        } finally {
                            field.setAccessible(isAccessible);
                        }
                    } catch (Exception e) {
                        // This shouldn't happen but if it does then the Component manager will not function properly
                        // and we need to abort. It probably means the Java security manager has been configured to
                        // prevent accessing private fields.
                        throw new RuntimeException("Failed to set field [" + fieldName + "] in instance of ["
                            + instanceContainingField.getClass().getName() + "]. The Java Security Manager has "
                            + "probably been configured to prevent settting private field values. XWiki requires "
                            + "this ability to work.", e);
                    }
                    return;
                }
            }
            targetClass = targetClass.getSuperclass();
        }
    }
246412
@Override
	public void setAttribute(String name, Object value) {
		attributesSupport.setAttribute(name, value);
	}
1183499
private static void setScalarParam(String name, Object value) throws ConfigurationException {
        try {
            Field field = config.getClass().getDeclaredField(name);
            field.set(config, value);
        } catch (SecurityException | NoSuchFieldException | IllegalAccessException e) {
            throw new ConfigurationException("Unknown configuration parameter: " + name);
        } catch (IllegalArgumentException e) {
            throw new ConfigurationException("Couldn't parse parameter: " + value);
        }
    }
73175
public <V> Reflecter<T> val(String propName, V propVal) {
		Triple<String, Field, Reflecter<Object>> triple = getNestRefInfo(propName);
		triple.getR().setPropVal(triple.getC(), triple.getL(), propVal);
		this.isChanged = true;
		return this;
	}
1367447
@Override
	public void setProperty(String name, Object value) {
		if(currentBeanConfig != null) {
			if(value instanceof GString)value = value.toString();
			if(addToDeferred(currentBeanConfig, name, value)) {
				return;
			}
			else if(value instanceof Closure) {
				BeanConfiguration current = currentBeanConfig;
				try {
					Closure callable = (Closure)value;

					Class parameterType = callable.getParameterTypes()[0];
					if(parameterType.equals(Object.class)) {
						currentBeanConfig = springConfig.createSingletonBean("");
						callable.call(new Object[]{currentBeanConfig});
					}
					else {
						currentBeanConfig = springConfig.createSingletonBean(parameterType);
						callable.call(null);
					}

					value = currentBeanConfig.getBeanDefinition();
				}
				finally {
					currentBeanConfig = current;
				}
			}
            currentBeanConfig.addProperty(name, value);
		} else {
            binding.put(name,value);
        }
	}