Assign a value - either to collection col or to a setter of o defined by meth
@param val
@param col - if non-null add to this.
@param o
@param meth
@throws Throwable
174758
private void assign(final Object val,
                      final Collection<Object> col,
                      final Object o,
                      final Method meth) throws Throwable {
    if (col != null) {
      col.add(val);
    } else {
      Object[] pars = new Object[]{val};

      meth.invoke(o, pars);
    }
  }
892875
public static void setValue(MetaPartition partition, AnyTypeObject dataObject, Object value) {
		MetaDataObject meta = (MetaDataObject) partition.getMeta(dataObject.getClass());
		if (value == null) {
			for (MetaAttribute attr : meta.getAttributes()) {
				attr.setValue(dataObject, null);
			}
		} else {
			boolean found = false;
			for (MetaAttribute attr : meta.getAttributes()) {
				if (attr.getName().equals(TYPE_ATTRIBUTE)) {
					continue;
				}
				if (attr.getType().getImplementationClass().isAssignableFrom(value.getClass())) {
					attr.setValue(dataObject, value);
					found = true;
				} else {
					attr.setValue(dataObject, null);
				}
			}
			if (!found) {
				throw new IllegalStateException("cannot assign " + value + " to " + dataObject);
			}
		}
	}
1129683
protected function setColumn($col, $val)
    {
        if (!isset($this->instance[$col]) || $this->instance[$col] != $val) {
            if (!isset($this->columns[$col]['ignore_updates']) || $this->columns[$col]['ignore_updates'] == false) {
                $this->record_changed = true;
            }
        }
        $this->instance[$col] = $val;
    }
108313
public void setValue(Object value) {
    if (value instanceof Iterable<?>) {
      this.value = stream((Iterable<?>) value).map(this::toValue).collect(toList());
    } else {
      this.value = toValue(value);
    }
  }
104924
public void addNextValue(Object val) {
    long newVal = Long.parseLong(val.toString());
    if (this.maxVal < newVal) {
      this.maxVal = newVal;
    }
  }
493007
public void setValueAt( int col, int row, double value ) {
        if (makeNew) {
            if (isInRaster(col, row)) {
                ((WritableRandomIter) iter).setSample(col, row, 0, value);
            } else {
                throw new RuntimeException("Setting value outside of raster.");
            }
        } else {
            throw new RuntimeException("Writing not allowed.");
        }
    }
418606
@SuppressWarnings({ "unchecked", "rawtypes" })
	public void set(String fieldName, Object value) throws BeanException{
		if(Map.class.isAssignableFrom(beanClass)){
			((Map)bean).put(fieldName, value);
			return;
		}else{
			try {
				final Method setter = BeanUtil.getBeanDesc(beanClass).getSetter(fieldName);
				if(null == setter){
					throw new BeanException("No set method for {}", fieldName);
				}
				setter.invoke(this.bean, value);
			} catch (Exception e) {
				throw new BeanException(e);
			}
		}
	}
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);
        }
    }
849454
def SetColumnValues(self, col, value):
        
        try:
            self.dataframe.iloc[:, col] = value
        except ValueError:
            self.dataframe.loc[:, col] = value
421802
void setFieldValue(final Object containingObj, final Object value) {
        try {
            if (value == null) {
                if (primitiveType != PrimitiveType.NON_PRIMITIVE) {
                    throw new IllegalArgumentException("Tried to set primitive-typed field "
                            + field.getDeclaringClass().getName() + "." + field.getName() + " to null value");
                }
                field.set(containingObj, null);
                return;
            }
            switch (primitiveType) {
            case NON_PRIMITIVE:
                field.set(containingObj, value);
                break;
            case INTEGER:
                if (!(value instanceof Integer)) {
                    throw new IllegalArgumentException(
                            "Expected value of type Integer; got " + value.getClass().getName());
                }
                field.setInt(containingObj, (Integer) value);
                break;
            case LONG:
                if (!(value instanceof Long)) {
                    throw new IllegalArgumentException(
                            "Expected value of type Long; got " + value.getClass().getName());
                }
                field.setLong(containingObj, (Long) value);
                break;
            case SHORT:
                if (!(value instanceof Short)) {
                    throw new IllegalArgumentException(
                            "Expected value of type Short; got " + value.getClass().getName());
                }
                field.setShort(containingObj, (Short) value);
                break;
            case DOUBLE:
                if (!(value instanceof Double)) {
                    throw new IllegalArgumentException(
                            "Expected value of type Double; got " + value.getClass().getName());
                }
                field.setDouble(containingObj, (Double) value);
                break;
            case FLOAT:
                if (!(value instanceof Float)) {
                    throw new IllegalArgumentException(
                            "Expected value of type Float; got " + value.getClass().getName());
                }
                field.setFloat(containingObj, (Float) value);
                break;
            case BOOLEAN:
                if (!(value instanceof Boolean)) {
                    throw new IllegalArgumentException(
                            "Expected value of type Boolean; got " + value.getClass().getName());
                }
                field.setBoolean(containingObj, (Boolean) value);
                break;
            case BYTE:
                if (!(value instanceof Byte)) {
                    throw new IllegalArgumentException(
                            "Expected value of type Byte; got " + value.getClass().getName());
                }
                field.setByte(containingObj, (Byte) value);
                break;
            case CHARACTER:
                if (!(value instanceof Character)) {
                    throw new IllegalArgumentException(
                            "Expected value of type Character; got " + value.getClass().getName());
                }
                field.setChar(containingObj, (Character) value);
                break;
            default:
                throw new IllegalArgumentException();
            }
        } catch (IllegalArgumentException | IllegalAccessException e) {
            throw new IllegalArgumentException(
                    "Could not set field " + field.getDeclaringClass().getName() + "." + field.getName(), e);
        }
    }
1305492
public void assign(double val) {
	for (int i = 0; i < rows; i++) {
	    for (int j = 0; j < cols; j++) {
		mtrx[i][j] = val;
	    }
	}
    }
1333216
@Override
  public void setValue(final String optionObjectName,
                       final String optionName,
                       final Object val) throws OptionsException {
    if (!useSystemwideValues) {
      // No screwing round with them
      throw new OptionsException("cannot.set.values");
    }

    try {
      Object opts = getProperty(optionObjectName);

      Method meth = findSetter(opts, optionName);

      Object[] pars = new Object[]{val};

      meth.invoke(opts, pars);
    } catch (Throwable t) {
      throw new OptionsException(t);
    }
  }
713406
private void addColumnValue(Object value, VoltType columnType, int col) {
        // schema checking code that is used for some tests
        boolean allowNulls = true;
        int maxColSize = VoltType.MAX_VALUE_LENGTH;
        if (m_extraMetadata != null) {
            allowNulls = m_extraMetadata.originalColumnInfos[col].nullable;
            maxColSize = m_extraMetadata.originalColumnInfos[col].size;
        }

        if (VoltType.isVoltNullValue(value)) {
            // schema checking code that is used for some tests
            // allowNulls should always be true in production
            if (allowNulls == false) {
                throw new IllegalArgumentException(
                        String.format("Column %s at index %d doesn't allow NULL values.",
                        getColumnName(col), col));
            }

            switch (columnType) {
            case TINYINT:
                m_buffer.put(VoltType.NULL_TINYINT);
                break;
            case SMALLINT:
                m_buffer.putShort(VoltType.NULL_SMALLINT);
                break;
            case INTEGER:
                m_buffer.putInt(VoltType.NULL_INTEGER);
                break;
            case TIMESTAMP:
                m_buffer.putLong(VoltType.NULL_BIGINT);
                break;
            case BIGINT:
                m_buffer.putLong(VoltType.NULL_BIGINT);
                break;
            case FLOAT:
                m_buffer.putDouble(VoltType.NULL_FLOAT);
                break;
            case STRING:
            case GEOGRAPHY:
            case VARBINARY:
                m_buffer.putInt(NULL_STRING_INDICATOR);
                break;
            case GEOGRAPHY_POINT:
                GeographyPointValue.serializeNull(m_buffer);
                break;
            case DECIMAL:
                VoltDecimalHelper.serializeNull(m_buffer);
                break;

            default:
                throw new VoltTypeException("Unsupported type: " +
                        columnType);
            }
        }
        else {

            // Allow implicit conversions across all numeric types
            // except BigDecimal and anything else. Require BigDecimal
            // and reject Long128. Convert byte[] to VoltType.STRING.
            // Allow longs to be converted to VoltType.TIMESTAMPS.

            // In all error paths, catch ClassCastException
            // and VoltTypeException to restore
            // the correct table state.
            // XXX consider adding a fast path that checks for
            // equivalent types of input and column

            try {
                switch (columnType) {
                case TINYINT:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n1 = (Number) value;
                    if (columnType.wouldCastOverflow(n1)) {
                        throw new VoltTypeException("Cast of " +
                                n1.doubleValue() +
                                " to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.put(n1.byteValue());
                    break;
                case SMALLINT:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n2 = (Number) value;
                    if (columnType.wouldCastOverflow(n2)) {
                        throw new VoltTypeException("Cast to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.putShort(n2.shortValue());
                    break;
                case INTEGER:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n3 = (Number) value;
                    if (columnType.wouldCastOverflow(n3)) {
                        throw new VoltTypeException("Cast to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.putInt(n3.intValue());
                    break;
                case BIGINT:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n4 = (Number) value;
                    if (columnType.wouldCastOverflow(n4)) {
                        throw new VoltTypeException("Cast to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.putLong(n4.longValue());
                    break;

                case FLOAT:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n5 = (Number) value;
                    if (columnType.wouldCastOverflow(n5)) {
                        throw new VoltTypeException("Cast to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.putDouble(n5.doubleValue());
                    break;

                case STRING: {
                    // Accept byte[] and String
                    if (value instanceof byte[]) {
                        if (((byte[]) value).length > maxColSize) {
                            throw new VoltOverflowException(
                                    "Value in VoltTable.addRow(...) larger than allowed max " +
                                            VoltType.humanReadableSize(maxColSize));
                        }

                        // bytes MUST be a UTF-8 encoded string.
                        assert(testForUTF8Encoding((byte[]) value));
                        writeStringOrVarbinaryToBuffer((byte[]) value, m_buffer);
                    }
                    else {
                        if (((String) value).length() > maxColSize) {
                            throw new VoltOverflowException(
                                    "Value in VoltTable.addRow(...) larger than allowed max " +
                                            VoltType.humanReadableSize(maxColSize));
                        }

                        writeStringToBuffer((String) value, ROWDATA_ENCODING, m_buffer);
                    }
                    break;
                }

                case VARBINARY: {
                    // Accept byte[] and String (hex-encoded)
                    if (value instanceof String) {
                        value = Encoder.hexDecode((String) value);
                    }
                    if (value instanceof byte[]) {
                        if (((byte[]) value).length > maxColSize) {
                            throw new VoltOverflowException(
                                    "Value in VoltTable.addRow(...) larger than allowed max " +
                                            VoltType.humanReadableSize(maxColSize));
                        }
                        writeStringOrVarbinaryToBuffer((byte[]) value, m_buffer);
                    }
                    else {
                        throw new ClassCastException();
                    }
                    break;
                }

                case GEOGRAPHY: {
                    GeographyValue gv = (GeographyValue)value;
                    m_buffer.putInt(gv.getLengthInBytes());
                    gv.flattenToBuffer(m_buffer);
                    break;
                }

                case GEOGRAPHY_POINT: {
                    GeographyPointValue pt = (GeographyPointValue)value;
                    pt.flattenToBuffer(m_buffer);
                    break;
                }

                case TIMESTAMP: {
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    long micros;
                    // Accept long and TimestampType and any kind of Date
                    if (value instanceof java.util.Date ||
                            value instanceof TimestampType) {
                         micros = ParameterSet.timestampToMicroseconds(value);
                    }
                    else {
                        micros = ((Number) value).longValue();
                    }
                    m_buffer.putLong(micros);
                    break;
                }

                case DECIMAL: {
                    // Only accept BigDecimal; rely on class cast exception for error path
                    VoltDecimalHelper.serializeBigDecimal( (BigDecimal)value, m_buffer);
                    break;
                }

                default:
                    throw new VoltTypeException("Unsupported type: " + columnType);
                }
            }
            catch (ClassCastException cce) {
                throw new VoltTypeException("Value for column " + col + " (" +
                        getColumnName(col) + ") is type " +
                        value.getClass().getSimpleName() + " when type " + columnType +
                        " was expected.");
            }
        }
    }
544578
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);
            }
        }
    }
592828
public void setValue(Object obj, Object value) {
    if (setters.length > 0) {
      for (Method method : setters) {
        if (value == null || method.getParameterTypes()[0].isAssignableFrom(value.getClass())) {
          try {
            method.invoke(obj, value);
            return;
          } catch (IllegalAccessException | InvocationTargetException e) {
            // try to set field directly
          }
        }
      }
    }
    setFieldValue(field, obj, value);
  }
1082789
def col(col, val = nil)
      if val.nil?
        get_col(col)
      else
        set_col(col, val)
      end
    end
744733
function setColumnValue($column_name, $value, $column_type = null) {
		if (null === $column_type) {
			$column_type = static::getColumnType($column_name);
		}

		static $true = array(true, 1, '1', 'on', 'true');
		static $false = array(false, 0, '0', 'off', 'false');

		if ($column_type === self::COLUMN_TYPE_BOOLEAN) {
			if (is_string($value)) {
				$value = strtolower($value);
			}
			if (in_array($value, $true, true)) {
				$value = 1;
			} elseif (in_array($value, $false, true)) {
				$value = 0;
			} elseif ($value === '' || $value === null) {
				$value = null;
			} else {
				throw new InvalidArgumentException($value . ' is not a valid boolean value');
			}
		} else {
			$temporal = static::isTemporalType($column_type);
			$numeric = static::isNumericType($column_type);

			if ($numeric || $temporal) {
				if (is_string($value)) {
					$value = trim($value);
				}
				if ('' === $value) {
					$value = null;
				} elseif (null !== $value) {
					if ($temporal) {
						$value = static::coerceTemporalValue($value, $column_type, static::getConnection());
					} elseif ($numeric) {
						if (is_bool($value)) {
							$value = $value ? 1 : 0;
						} elseif (static::isIntegerType($column_type)) {
							// validate and cast
							if (!is_int($value)) {
								$int_val = intval($value);
								if ((string) $int_val != (string) $value) {
									throw new InvalidArgumentException($value . ' is not a valid integer or it is too large');
								}
								$value = $int_val;
							}
						} else {
							// only validates, doesn't cast...yet
							$float_val = floatval($value);
							if ((string) $float_val != (string) $value) {
								throw new InvalidArgumentException($value . ' is not a valid float or it is too large');
							}
						}
					}
				}
			}
		}

		if ($this->$column_name !== $value) {
			$this->_modifiedColumns[$column_name] = $column_name;
			$this->$column_name = $value;
		}
		return $this;
	}