根据Field类型设置值

@param field
769755
public static void setFieldValeByType(Field field, Object obj, String value)
            throws Exception {

        Class<?> type = field.getType();

        String typeName = type.getName();

        if (typeName.equals("int")) {

            if (value.equals("")) {
                value = "0";
            }
            field.set(obj, Integer.valueOf(value));

        } else if (typeName.equals("long")) {

            if (value.equals("")) {
                value = "0";
            }
            field.set(obj, Long.valueOf(value));

        } else if (typeName.equals("boolean")) {

            if (value.equals("")) {
                value = "false";
            }
            field.set(obj, Boolean.valueOf(value));

        } else if (typeName.equals("double")) {

            if (value.equals("")) {
                value = "0.0";
            }
            field.set(obj, Double.valueOf(value));

        } else {

            field.set(obj, value);
        }
    }
1277874
private void checkFieldDescriptor(FieldDescriptor field) {
        if (field.getContainingType() != metadata.descriptor) {
            throw new RuntimeException("Wrong FieldDescriptor \"" + field.getFullName() + "\" used in message \""
                    + metadata.descriptor.getFullName());
        }
    }
248314
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case KEY:
      return isSetKey();
    case COUNT:
      return isSetCount();
    }
    throw new IllegalStateException();
  }
435161
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case TYPE:
      return isSetType();
    case COLUMN_PATH:
      return isSetColumnPath();
    }
    throw new IllegalStateException();
  }
78010
void selectFieldFacet(String field, String value) {

        m_selectedFieldFacets.clear();
        m_selectedRangeFacets.clear();
        m_selectedFieldFacets.put(field, Collections.singletonList(value));
        m_manager.search(m_selectedFieldFacets, m_selectedRangeFacets);
    }
466519
public void setCustomFields(Map<String, String> fields) {
        clearCustomFields();
        for (String key : fields.keySet()) {
            CustomField f = new CustomField();
            f.setName(key);
            f.setValue(fields.get(key));
            customFields.add(f);
        }
    }
1246521
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case COL_VALS:
      return isSetColVals();
    }
    throw new IllegalStateException();
  }
938497
function(field) {
    if (this.vars.hasOwnProperty(field)) {
      if (!this.usage.hasOwnProperty(field)) {
        this.usage[field] = 0;
      }
      this.usage[field]++;
    }
  }
356368
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case NAME:
      return isSetName();
    case DATA_TYPE:
      return isSetDataType();
    case ENCODING:
      return isSetEncoding();
    case OTHER_ARGS:
      return isSetOtherArgs();
    }
    throw new IllegalStateException();
  }
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());
		}
	}
253661
static FieldPath fromDotSeparatedString(String field) {
    if (PROHIBITED_CHARACTERS.matcher(field).matches()) {
      throw new IllegalArgumentException("Use FieldPath.of() for field names containing '˜*/[]'.");
    }
    return empty().append(field);
  }
821780
@Override
	public void addField(final SchemaField field) {

		if (field instanceof FieldDefinition) {
			addField((FieldDefinition) field);
		} else if (field instanceof CopyFieldDefinition) {
			addCopyField((CopyFieldDefinition) field);
		}
	}
962386
public int fieldIndex(String field) {
    Integer ret = mIndex.get(field);
    if (ret == null) {
      throw new IllegalArgumentException(field + " does not exist");
    }
    return ret;
  }
575928
protected void setField(final Field field, final IFile pData, final Object pValue) {
		if (field != null) {
			try {
				field.set(pData, pValue);
			} catch (IllegalArgumentException e) {
				LOGGER.error("Parameters of fied.set are not valid", e);
			} catch (IllegalAccessException e) {
				LOGGER.error("Impossible to set the Field :" + field.getName(), e);
			}
		}
	}
1333258
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case TYPES:
      return isSetTypes();
    }
    throw new IllegalStateException();
  }
657880
private Object getFieldValue(Field field) {
        try {
            field.setAccessible(true);
            return field.get(this);
        } catch (IllegalArgumentException | IllegalAccessException e) {
            LOGGER.error("Can't access to field value", e);
            return null;
        }
    }
1162715
private void writeField(FieldType field, Object value) throws IOException
   {
      String fieldName = field.name().toLowerCase();
      writeField(fieldName, field.getDataType(), value);
   }