/*
Internal: Static version of {@link ObjectWrapper#setValue(String, Object)}
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);
        }
    }
1238255
private void setFixedValue(final String value) {
		boolean toBeLogged = false;
		if (log.isDebugEnabled() && (value != null && !value.equals(fixedValue) || fixedValue != null && !fixedValue.equals(value))) {
			toBeLogged = true;
		}
		fixedValue = value;
		currentValue = null;
		if (toBeLogged) {
			log.debug("setFixedValue: " + this);
		}

	}
312089
public ParamWrapper put(String key, Object value) {
        this.paramMap.put(key, value);
        return this;
    }
441108
public void setValue(String value) {
        ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
        builder.put("id", id).put("value", value);
        execute(MobileCommand.SET_VALUE, builder.build());
    }
417880
@Override
    public Object getValue(String name)
    {
        if (arguments == null)
        {
            throw new IllegalStateException("setArgs not called");
        }
        Object ob = options.get(name);
        if (ob != null)
        {
            return ob;
        }
        return arguments.get(name);
    }
835089
@Override
	public final void setObjectProperty(String name, Object value) throws JMSException
    {
        if (value == null)
            throw new MessageFormatException("A property value cannot be null");
            
        // Check type
        if (!(value instanceof Boolean ||
              value instanceof Byte ||
              value instanceof Short ||
              value instanceof Integer ||
              value instanceof Long ||
              value instanceof Float ||
              value instanceof Double ||
              value instanceof String))
            throw new MessageFormatException("Unsupported property value type : "+value.getClass().getName());
        
        setProperty(name,value);
    }
281498
@Override
    public void setValue(Object value) {
        if (value instanceof Date || value == null) {
            this.text = null;
            super.setValue(value);
        } else {
            throw new IllegalArgumentException("setValue() expected java.util.Date value, got " + value.getClass().getName());
        }
    }
1303203
public void setProperty(String strKey, Object objValue)
    {
        if (m_mapParams == null)
            m_mapParams = new HashMap<String,Object>();
        m_mapParams.put(strKey, objValue);
    }
498989
@Override
  public void setValue(final List<T> value) {
    if (list == null && value == null) {
      // fast exit
      return;
    }
    if (list != null && list.isSameValue(value)) {
      // setting the same value as the one being edited
      list.refresh();
      return;
    }

    if (list != null) {
      // Having entire value reset, so dump the wrapper gracefully
      list.detach();
    }
    if (value == null) {
      list = null;
    } else {
      list = new ListValidationEditorWrapper<>(value, chain, editorSource, parentDriver);
      list.attach();
    }
  }
77737
public void setValue( Object value, int context )
        throws UtilEvalError
    {

        // prevent final variable re-assign
        if (hasModifier("final")) {
            if (this.value != null)
                throw new UtilEvalError("Cannot re-assign final variable "+name+".");
            if (value == null)
                return;
        }

        // TODO: should add isJavaCastable() test for strictJava
        // (as opposed to isJavaAssignable())
        if ( type != null && type != Object.class && value != null ) {
            this.value = Types.castObject( value, type,
                context == DECLARATION ? Types.CAST : Types.ASSIGNMENT
            );
            value = this.value;
        }

        this.value = value;

        if ( this.value == null && context != DECLARATION )
            this.value = Primitive.getDefaultValue( type );

        if ( lhs != null )
            this.value = lhs.assign( this.value, false/*strictjava*/ );

    }
88974
public void setAsObject(Object value) {
		clear();
		Map<String, Object> values = MapConverter.toMap(value);
		append(values);
	}
303298
def updateCurrentValue(self, value):
        
        try:
            method = getattr(self._targetObject, self._setter)
        except AttributeError:
            return
        
        try:
            method(unwrapVariant(value))
        except:
            return
879653
public static void setFieldValue(final Object obj, final String fieldName, final Object value) {
		Field field = getField(obj.getClass(), fieldName);
		if (field == null) {
			throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + ']');
		}
		setField(obj, field, value);
	}
1359868
public T set(T newValue) {
		final T obj = this.object;
		this.object = newValue;
		return obj;
	}
404033
public static void set(Object obj, String property, Object value) throws Throwable {
        getSetterMethod(obj.getClass(), property).invoke(obj, value);
    }
56492
private Object wrap(final Object value) {

		if (value instanceof Map) {

			return new MapResultWrapper(db, (Map)value);
		}

		if (value instanceof Collection) {

			return wrap((Collection)value);
		}

		return wrapper.apply(value);
	}
739397
public void setAsObject(Object value) {
		if (value instanceof AnyValue)
			_value = ((AnyValue) value)._value;
		else
			_value = value;
	}