Writes the given field and the value to the JsonGenerator

@param fieldName
the JSON field name
@param value
value for the field
540236
private void writeJsonKeyValue(String fieldName, String value)
            throws JsonGenerationException, IOException {
        generator.writeStringField(fieldName, value);
    }
1277645
@Override
    protected void write(JsonGenerator g, JacksonJrsTreeCodec codec) throws IOException {
        g.writeString(_value);
    }
846601
private void writeJsonArray(String arrayName, List<String> values)
            throws JsonGenerationException, IOException {
        writeJsonArrayStart(arrayName);
        for (String value : values)
            generator.writeString(value);
        writeJsonArrayEnd();
    }
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);
			}
		}
	}
1147897
private void writeIntegerField(String fieldName, Object value) throws IOException
   {
      int val = ((Number) value).intValue();
      if (val != 0)
      {
         m_writer.writeNameValuePair(fieldName, val);
      }
   }
317847
private void writeFields(JsonWriterImpl out, Object value)
  {
    for (JsonField field : _fields) {
      field.write(out, value);
    }
  }
883439
public final void writeNumberField(String fieldName, int value)
        throws IOException, JsonGenerationException
    {
        writeFieldName(fieldName);
        writeNumber(value);
    }
646685
public void write(JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartObject();

    // nameToNode begins
    jsonGenerator.writeFieldName("nameToNode");
    jsonGenerator.writeStartObject();
    for (Map.Entry<String, ClusterNode> entry : nameToNode.entrySet()) {
      jsonGenerator.writeFieldName(entry.getKey());
      entry.getValue().write(jsonGenerator);
    }
    jsonGenerator.writeEndObject();
    // nameToNode ends

    // hostsToSessions begins
    // We create a new Map of type <ClusterNode.name, Set<SessionIds>>.
    // The original hostsToSessions map has the ClusterNode as its key, and
    // we do not need to persist the entire ClusterNode again, since we have
    // already done that with nameToNode.
    Map<String, Set<String>> hostsToSessionsMap =
      new HashMap<String, Set<String>>();
    for (Map.Entry<ClusterNode, Set<String>> entry :
      hostsToSessions.entrySet()) {
      hostsToSessionsMap.put(entry.getKey().getName(),
        entry.getValue());
    }
    jsonGenerator.writeObjectField("hostsToSessions", hostsToSessionsMap);
    // hostsToSessions ends

    jsonGenerator.writeObjectField("nameToApps", nameToApps);

    // faultManager is not required

    // We can rebuild the loadManager
    jsonGenerator.writeEndObject();
  }
72438
public static void addFieldValue(List<FieldMeta> fieldValues,String fieldName,Object value){
		FieldMeta fieldMeta = new FieldMeta();
		fieldMeta.setEsFieldName(fieldName);
		fieldMeta.setValue(value);
		fieldValues.add(fieldMeta);
	}
957711
@SuppressWarnings({ "unchecked", "rawtypes" })
	public static void setFieldValue(Object bean, String fieldNameOrIndex, Object value) {
		if (bean instanceof Map) {
			((Map) bean).put(fieldNameOrIndex, value);
		} else if (bean instanceof List) {
			CollUtil.setOrAppend((List) bean, Convert.toInt(fieldNameOrIndex), value);
		} else if (ArrayUtil.isArray(bean)) {
			ArrayUtil.setOrAppend(bean, Convert.toInt(fieldNameOrIndex), value);
		} else {
			// 普通Bean对象
			ReflectUtil.setFieldValue(bean, fieldNameOrIndex, value);
		}
	}
345403
public void addFieldValues(String fieldName, Collection<String> values) {
        Utils.require(!Utils.isEmpty(fieldName), "fieldName");
        
        if (values != null && values.size() > 0) {
            if (fieldName.charAt(0) == '_') {
                Utils.require(values.size() == 1, "System fields can have only 1 value: " + fieldName);
                setSystemField(fieldName, values.iterator().next());
            } else {
                List<String> currValues = m_valueMap.get(fieldName);
                if (currValues == null) {
                    currValues = new ArrayList<>();
                    m_valueMap.put(fieldName, currValues);
                }
                currValues.addAll(values);
            }
        }
    }
977493
private void writeName(JsonGenerator jsonGenerator, Object entity) throws IOException {
        jsonGenerator.writeFieldName(NAME);
        if (entity instanceof EntitySet) {
            jsonGenerator.writeObject(((EntitySet) entity).getName());
        } else {
            jsonGenerator.writeObject(((Singleton) entity).getName());
        }
    }
758298
public void writeField (Object object, String fieldName, String jsonName, Class elementType) {
		Class type = object.getClass();
		ObjectMap<String, FieldMetadata> fields = getFields(type);
		FieldMetadata metadata = fields.get(fieldName);
		if (metadata == null) throw new JsonException("Field not found: " + fieldName + " (" + type.getName() + ")");
		Field field = metadata.field;
		if (elementType == null) elementType = metadata.elementType;
		try {
			if (debug) System.out.println("Writing field: " + field.getName() + " (" + type.getName() + ")");
			writer.name(jsonName);
			writeValue(field.get(object), field.getType(), elementType);
		} catch (IllegalAccessException ex) {
			throw new JsonException("Error accessing field: " + field.getName() + " (" + type.getName() + ")", ex);
		} catch (JsonException ex) {
			ex.addTrace(field + " (" + type.getName() + ")");
			throw ex;
		} catch (Exception runtimeEx) {
			JsonException ex = new JsonException(runtimeEx);
			ex.addTrace(field + " (" + type.getName() + ")");
			throw ex;
		}
	}
765644
public static void writeValueToBeanField(Object entityBean, String fieldName, Object value) {
		Method writeMethod = ClassCacheUtils.getClassFieldWriteMethod(entityBean.getClass(), fieldName);
		if (writeMethod == null) {
			throw new DialectException("Can not find Java bean read method '" + fieldName + "'");
		} else
			try {
				writeMethod.invoke(entityBean, value);
			} catch (Exception e) {
				throw new DialectException("FieldName '" + fieldName + "' can not write with value '" + value + "'", e);
			}
	}
1045081
public void add(String name, String value) {
        if (value == null)
            return;

        HttpField field = new HttpField(name, value);
        add(field);
    }
1034700
@com.fasterxml.jackson.annotation.JsonProperty("FieldName")
    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }
198502
private void writeMap(String fieldName, Object value) throws IOException
   {
      @SuppressWarnings("unchecked")
      Map<String, Object> map = (Map<String, Object>) value;
      m_writer.writeStartObject(fieldName);
      for (Map.Entry<String, Object> entry : map.entrySet())
      {
         Object entryValue = entry.getValue();
         if (entryValue != null)
         {
            DataType type = TYPE_MAP.get(entryValue.getClass().getName());
            if (type == null)
            {
               type = DataType.STRING;
               entryValue = entryValue.toString();
            }
            writeField(entry.getKey(), type, entryValue);
         }
      }
      m_writer.writeEndObject();
   }