private void generateObject(JsonWriter generator, ConfigurationNode node) throws IOException { if (!node.hasMapChildren()) { throw new IOException("Node passed to generateObject does not have map children!"); } generator.beginObject(); for (Map.Entry<Object, ? extends ConfigurationNode> ent : node.getChildrenMap().entrySet()) { generator.name(ent.getKey().toString()); generateValue(generator, ent.getValue()); } generator.endObject(); }
private static void generateObject(JsonWriter generator, ConfigurationNode node) throws IOException { if (!node.hasMapChildren()) { throw new IOException("Node passed to generateObject does not have map children!"); } generator.beginObject(); for (Map.Entry<Object, ? extends ConfigurationNode> ent : node.getChildrenMap().entrySet()) { generator.name(ent.getKey().toString()); generateValue(generator, ent.getValue()); } generator.endObject(); }
private static void generateObject(JsonWriter generator, ConfigurationNode node) throws IOException { if (!node.hasMapChildren()) { throw new IOException("Node passed to generateObject does not have map children!"); } generator.beginObject(); for (Map.Entry<Object, ? extends ConfigurationNode> ent : node.getChildrenMap().entrySet()) { generator.name(ent.getKey().toString()); generateValue(generator, ent.getValue()); } generator.endObject(); }
private static void generateArray(JsonWriter generator, ConfigurationNode node) throws IOException { if (!node.hasListChildren()) { throw new IOException("Node passed to generateArray does not have list children!"); } List<? extends ConfigurationNode> children = node.getChildrenList(); generator.beginArray(); for (ConfigurationNode child : children) { generateValue(generator, child); } generator.endArray(); } }
@Override public void saveInternal(ConfigurationNode node, Writer writer) throws IOException { if (!lenient && !node.hasMapChildren()) { throw new IOException("Non-lenient json generators must have children of map type"); } try (JsonWriter generator = new JsonWriter(writer)) { generator.setIndent(indent); generator.setLenient(lenient); generateValue(generator, node); generator.flush(); writer.write(SYSTEM_LINE_SEPARATOR); // Jackson doesn't add a newline at the end of files by default } }
private static void generateArray(JsonWriter generator, ConfigurationNode node) throws IOException { if (!node.hasListChildren()) { throw new IOException("Node passed to generateArray does not have list children!"); } List<? extends ConfigurationNode> children = node.getChildrenList(); generator.beginArray(); for (ConfigurationNode child : children) { generateValue(generator, child); } generator.endArray(); } }
private void generateArray(JsonWriter generator, ConfigurationNode node) throws IOException { if (!node.hasListChildren()) { throw new IOException("Node passed to generateArray does not have list children!"); } List<? extends ConfigurationNode> children = node.getChildrenList(); generator.beginArray(); for (ConfigurationNode child : children) { generateValue(generator, child); } generator.endArray(); } }
@Override public void saveInternal(ConfigurationNode node, Writer writer) throws IOException { if (!lenient && !node.hasMapChildren()) { throw new IOException("Non-lenient json generators must have children of map type"); } try (JsonWriter generator = new JsonWriter(writer)) { generator.setIndent(indent); generator.setLenient(lenient); generateValue(generator, node); generator.flush(); writer.write(SYSTEM_LINE_SEPARATOR); // Jackson doesn't add a newline at the end of files by default } }
@Override public void saveInternal(ConfigurationNode node, Writer writer) throws IOException { if (!lenient && !node.hasMapChildren()) { throw new IOException("Non-lenient json generators must have children of map type"); } try (JsonWriter generator = new JsonWriter(writer)) { generator.setIndent(indent); generator.setLenient(lenient); generateValue(generator, node); generator.flush(); writer.write(SYSTEM_LINE_SEPARATOR); // Jackson doesn't add a newline at the end of files by default } }