void writeString(String str) { writeString(str, 0, str.length()); }
private void writeValue(String value) { writeComma(); writeString(value); }
@Override public JsonGenerator write(String name, double value) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } if (Double.isInfinite(value) || Double.isNaN(value)) { throw new NumberFormatException(JsonMessages.GENERATOR_DOUBLE_INFINITE_NAN()); } writeName(name); writeString(String.valueOf(value)); return this; }
@Override public JsonGenerator write(String name, BigDecimal value) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString(String.valueOf(value)); return this; }
@Override public JsonGenerator write(String name, long value) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString(String.valueOf(value)); return this; }
@Override public JsonGenerator write(String name, BigInteger value) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString(String.valueOf(value)); return this; }
@Override public JsonGenerator writeNull(String name) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString("null"); return this; }
@Override public JsonGenerator writeNull() { checkContextForValue(); writeComma(); writeString("null"); popFieldContext(); return this; }
@Override public JsonGenerator write(String name, boolean value) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString(value? "true" : "false"); return this; }
@Override public JsonGenerator write(boolean value) { checkContextForValue(); writeComma(); writeString(value ? "true" : "false"); popFieldContext(); return this; }
private void writeValue(String name, String value) { writeComma(); writeEscapedString(name); writeColon(); writeString(value); }
writeString(string, begin, end); if (i == len) { break; default: String hex = "000" + Integer.toHexString(c); writeString("\\u" + hex.substring(hex.length() - 4));
@Override public JsonGenerator write(String name, BigInteger value) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString(String.valueOf(value)); return this; }
@Override public JsonGenerator write(String name, long value) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString(String.valueOf(value)); return this; }
@Override public JsonGenerator write(String name, BigDecimal value) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString(String.valueOf(value)); return this; }
@Override public JsonGenerator write(boolean value) { checkContextForValue(); writeComma(); writeString(value ? "true" : "false"); popFieldContext(); return this; }
@Override public JsonGenerator write(String name, boolean value) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString(value? "true" : "false"); return this; }
@Override public JsonGenerator writeNull(String name) { if (currentContext.scope != Scope.IN_OBJECT) { throw new JsonGenerationException( JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope)); } writeName(name); writeString("null"); return this; }
private void writeValue(String name, String value) { writeComma(); writeEscapedString(name); writeColon(); writeString(value); }
@Override public JsonGenerator writeNull() { checkContextForValue(); writeComma(); writeString("null"); popFieldContext(); return this; }