public Object putProperty(String name, Object value) {
    PropertyType<?> type = getTypeOf(name);
    if (type == null) {
      throw new IllegalArgumentException("property " + name + " is not declared");
    }
    Object validated = type.cast(value);
    if (validated == null) {
      throw new IllegalArgumentException("property " + name
          + ", type " + type.getName() + ", " + value);
    }
    if (!dirty) {
      final Map<String, Object> map = this.properties;
      synchronized (map) {
        // copy on write
        this.properties = new TreeMap<>(map);
        dirty = true;
      }
    }
    final Map<String, Object> map = this.properties;
    synchronized (map) {
      digest = null;
      return map.put(name, validated);
    }
  }
Sets the value of a property.

@param name  the property name
@param value the value
@return the previous value or null
@throws IllegalArgumentException if the property is not declared or the value is of an incorrect type
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/properties/PropertyMap.java