/** * Ensures that the object is in the finished state. * * @throws JsonWriterException if the written JSON is not properly balanced, ie: all arrays and * objects that were started have been properly ended. */ protected void doneInternal() { if (states.size() > 0) throw new JsonWriterException("Unclosed JSON objects and/or arrays when closing writer"); if (first) throw new JsonWriterException("Nothing was written to the JSON writer"); }
/** * Ensures that the object is in the finished state. * * @throws JsonWriterException if the written JSON is not properly balanced, ie: all arrays and * objects that were started have been properly ended. */ protected void doneInternal() { if (states.size() > 0) throw new JsonWriterException("Unclosed JSON objects and/or arrays when closing writer"); if (first) throw new JsonWriterException("Nothing was written to the JSON writer"); }
/** * Ensures that the object is in the finished state. * * @throws JsonWriterException if the written JSON is not properly balanced, ie: all arrays and * objects that were started have been properly ended. */ protected void doneInternal() { if (states.size() > 0) throw new JsonWriterException("Unclosed JSON objects and/or arrays when closing writer"); if (first) throw new JsonWriterException("Nothing was written to the JSON writer"); }
private JsonArray arr() { try { return (JsonArray)json.peek(); } catch (ClassCastException e) { throw new JsonWriterException("Attempted to write a non-keyed value to a JsonObject"); } } }
private JsonObject obj() { try { return (JsonObject)json.peek(); } catch (ClassCastException e) { throw new JsonWriterException("Attempted to write a keyed value to a JsonArray"); } }
private void raw(char c) { try { appendable.append(c); } catch (IOException e) { throw new JsonWriterException(e); } }
private void raw(String s) { try { appendable.append(s); } catch (IOException e) { throw new JsonWriterException(e); } }
private JsonArray arr() { try { return (JsonArray)json.peek(); } catch (ClassCastException e) { throw new JsonWriterException("Attempted to write a non-keyed value to a JsonObject"); } } }
private void raw(char c) { try { appendable.append(c); } catch (IOException e) { throw new JsonWriterException(e); } }
private JsonArray arr() { try { return (JsonArray)json.peek(); } catch (ClassCastException e) { throw new JsonWriterException("Attempted to write a non-keyed value to a JsonObject"); } } }
private void raw(String s) { try { appendable.append(s); } catch (IOException e) { throw new JsonWriterException(e); } }
private void raw(char c) { try { appendable.append(c); } catch (IOException e) { throw new JsonWriterException(e); } }
private JsonObject obj() { try { return (JsonObject)json.peek(); } catch (ClassCastException e) { throw new JsonWriterException("Attempted to write a keyed value to a JsonArray"); } }
@Override public JsonBuilder<T> end() { if (json.size() == 1) throw new JsonWriterException("Cannot end the root object or array"); json.pop(); return this; }
@Override public JsonBuilder<T> end() { if (json.size() == 1) throw new JsonWriterException("Cannot end the root object or array"); json.pop(); return this; }
@Override public JsonBuilder<T> end() { if (json.size() == 1) throw new JsonWriterException("Cannot end the root object or array"); json.pop(); return this; }
private void preValue() { if (inObject) throw new JsonWriterException("Invalid call to emit a keyless value while writing an object"); pre(); }
private void preValue() { if (inObject) throw new JsonWriterException("Invalid call to emit a keyless value while writing an object"); pre(); }
private void preValue(String key) { if (!inObject) throw new JsonWriterException("Invalid call to emit a key value while not writing an object"); pre(); emitStringValue(key); raw(':'); }
private void preValue(String key) { if (!inObject) throw new JsonWriterException("Invalid call to emit a key value while not writing an object"); pre(); emitStringValue(key); raw(':'); }