Java 类org.bson.json.JsonMode 实例源码

项目:emfjson-mongo    文件:JsonWriter.java   
public JsonWriter(final Writer writer, final JsonWriterSettings settings) {
    super(writer, settings);
    this.settings = settings;
    if (settings.getOutputMode().equals(JsonMode.SHELL))
        throw new IllegalArgumentException("JsonMode must not be SHELL");
    setContext(new Context(null, BsonContextType.TOP_LEVEL, ""));
}
项目:restheart    文件:MetricsHandler.java   
@Override
public String generateResponse(MetricRegistry registry) throws IOException {
    BsonDocument document = MetricsJsonGenerator.generateMetricsBson(registry, TimeUnit.SECONDS, TimeUnit.MILLISECONDS);
    return document.toJson(
            JsonWriterSettings.builder().outputMode(JsonMode.RELAXED).indent(true).build()
    );
}
项目:mongofx    文件:DocumentUtils.java   
public static String formatJson(Document doc) {
  return doc.toJson(new JsonWriterSettings(JsonMode.SHELL, true));
}
项目:json-parse-helper    文件:JsonParseHelperTest.java   
@Test
public void bsonDocumentShellTest() {
    assertNotNull(bsonDocument);
    assertEquals("{\"_id\":\"5662e5798172910f5a925a43\", \"date\":\"2015-12-05T13:26:23.184\", \"pattern\":\"\\\\d/i\", \"pattern2\":\"\\\\s\", \"long\":9223372036854775807, \"null\":null, \"double\":1.0, \"string\":\"thiago\", \"boolean\":true, \"doc\":{\"key\":\"value\"}, \"list\":[\"value\"], \"map\":{\"key\":\"value\"}}", parse(bsonDocument.toJson(new JsonWriterSettings(JsonMode.SHELL))));
}
项目:json-parse-helper    文件:JsonParseHelperTest.java   
@Test
public void documentStrictTest() {
    assertNotNull(document);
    assertEquals("{\"_id\":\"5662e5798172910f5a925a43\", \"date\":\"2015-12-05T13:26:23.184\", \"pattern\":\"\\\\d/i\", \"pattern2\":\"\\\\s\", \"long\":9223372036854775807, \"null\":null, \"double\":1.0, \"string\":\"thiago\", \"boolean\":true, \"doc\":{\"key\":\"value\"}, \"list\":[\"value\"], \"map\":{\"key\":\"value\"}}", parse(document.toJson(new JsonWriterSettings(JsonMode.STRICT))));
}
项目:json-parse-helper    文件:JsonParseHelperTest.java   
@Test
public void documentShellTest() {
    assertNotNull(document);
    assertEquals("{\"_id\":\"5662e5798172910f5a925a43\", \"date\":\"2015-12-05T13:26:23.184\", \"pattern\":\"\\\\d/i\", \"pattern2\":\"\\\\s\", \"long\":9223372036854775807, \"null\":null, \"double\":1.0, \"string\":\"thiago\", \"boolean\":true, \"doc\":{\"key\":\"value\"}, \"list\":[\"value\"], \"map\":{\"key\":\"value\"}}", parse(document.toJson(new JsonWriterSettings(JsonMode.SHELL))));
}