Adds a value to a writer if value is not <code>null</code>.

@param writer
writer to add object to.
@param field
field name to set.
@param value
field value.
@throws JSONException
if io error occurs.
176134
public static void addIfNotNullShort(JSONWriter writer, String field,
			Date value) throws JSONException {
		final SimpleDateFormat format = RedmineDateUtils.SHORT_DATE_FORMAT
				.get();
		JsonOutput.addIfNotNull(writer, field, value, format);
	}
119083
@Override
  public void write(JsonWriterImpl out, AtomicInteger value)
  {
    out.write(value.get());
  }
1112703
public JsonWriter writeValue(Boolean value) throws IOException {
        if (!willWriteValue) {
            indent();
        }
        writer.write(value.toString());
        willWriteValue = false;
        return this;
    }
567355
public void writeValue(Object value) throws IOException
    {
        if (value == null) {
            writeNullValue();
            return;
        }
        _writeValue(value, _writerLocator.findSerializationType(value.getClass()));
    }
573856
private void appendValue(String string) throws JSONException {
        assert string != null;
        if (m_mode == 'k' || m_mode == 'i' || m_mode == 'd') {
            throw new JSONException("Value out of sequence.");
        }
        try {
            if (m_mode == 'a') {
                if (m_expectingComma) {
                    m_writer.write(',');
                }
            }
            else if (m_mode == 'o') {
                m_mode = 'k';
            }
            m_writer.write(string);
        }
        catch (IOException e) {
            throw new JSONException(e);
        }
        m_expectingComma = true;
    }
896958
@Override
  public void write(JsonWriterImpl out, T value)
  {
    if (value == null) {
      out.writeNull();
    }
    else if (value.getClass() != Object.class) {
      out.writeObjectValue(value);
    }
  }
3303
public void serialize( JsonWriter writer, T bean, JsonSerializationContext ctx ) {
        Map map = getValue( bean, ctx );
        if ( null != map ) {
            ((MapJsonSerializer) getSerializer()).serializeValues( writer, map, ctx, getParameters() );
        }
    }
707832
public static void put(Writer writer, Enum<?> value) throws IOException {
		if (value == null) {
			writer.write("null");
		} else {
			writer.write("\"");
			writer.write(sanitize(value.name()));
			writer.write("\"");
		}
	}
834653
public JSONWriter valueString(String value) throws IOException {
        beforeValue();

        writer.write(JSON.QUOTE);
        writer.write(escape(value));
        writer.write(JSON.QUOTE);
        return this;
    }
1142357
public void add(String name, JsonBuffer value) {
		if (value != null && value != this && !value.isEmpty()) {
			this.content.put(name, value);
		}
	}
429324
public static void putByteList(Writer writer, List<Byte> values) throws IOException {
		if (values == null) {
			writer.write("null");
		} else {
			startArray(writer);
			for (int i = 0; i < values.size(); i++) {
				put(writer, values.get(i));
				if (i != values.size() - 1) {
					addSeparator(writer);
				}
			}
			endArray(writer);
		}
	}
1113617
public static void addIfNotNull(JSONWriter writer, String field,
			Date value, final SimpleDateFormat format) throws JSONException {
		if (value == null)
			return;
		writer.key(field);
		writer.value(format.format(value));
	}
412106
@JsonAnySetter
	public void setAdditionalField(final String key, final Object value) {
		this.additionalFields.put(key, value);
	}
909
public static void addIfNotNull(JSONWriter writer, String field,
			Boolean value) throws JSONException {
		if (value == null)
			return;
		writer.key(field);
		writer.value(value);
	}
311904
private void appendPrimitive(JsonWriter writer, Object primitive) throws SerializerException {
        if (primitive instanceof PEnumValue) {
            if (IdType.ID.equals(enumValueType)) {
                writer.value(((PEnumValue<?>) primitive).asInteger());
            } else {
                writer.valueUnescaped(primitive.toString());
            }
        } else if (primitive instanceof Boolean) {
            writer.value(((Boolean) primitive));
        } else if (primitive instanceof Byte) {
            writer.value(((Byte) primitive));
        } else if (primitive instanceof Short) {
            writer.value(((Short) primitive));
        } else if (primitive instanceof Integer) {
            writer.value(((Integer) primitive));
        } else if (primitive instanceof Long) {
            writer.value(((Long) primitive));
        } else if (primitive instanceof Double) {
            writer.value(((Double) primitive));
        } else if (primitive instanceof CharSequence) {
            writer.value((String) primitive);
        } else if (primitive instanceof Binary) {
            writer.value((Binary) primitive);
        } else {
            throw new SerializerException("illegal primitive type class " + primitive.getClass()
                                                                                     .getSimpleName());
        }
    }
1140824
public JsonArray add(JsonValue value) {
    if (value == null) {
      throw new NullPointerException("value is null");
    }
    values.add(value);
    return this;
  }
151841
public JsonSerializationException traceError( Object value, String message, JsonWriter writer ) {
        JsonSerializationException exception = traceError( value, message );
        traceWriterInfo( value, writer );
        return exception;
    }