@Test void map() { final JsonObject object = new RecordJsonMapper(Json.createBuilderFactory(emptyMap()), new Singer(new IO(), ZonedDateTime::now)) .apply(factory .newRecordBuilder() .withString("name", "hello") .withInt("age", 1) .withBoolean("toggle", true) .withDateTime("date", ZonedDateTime.of(2019, 8, 23, 16, 31, 0, 0, ZoneId.of("UTC"))) .withLong("lg", 2L) .withBytes("bytes", "test".getBytes(StandardCharsets.UTF_8)) .withRecord("nested", factory .newRecordBuilder() .withString("value", "set") .withRecord("nested2", factory.newRecordBuilder().withInt("l2", 2).build()) .build()) .withArray(factory .newEntryBuilder() .withType(Schema.Type.ARRAY) .withName("array") .withElementSchema(factory.newSchemaBuilder(Schema.Type.STRING).build()) .build(), singleton("value-from-array")) .build()); assertEquals("{" + "\"name\":\"hello\"," + "\"age\":1," + "\"toggle\":true," + "\"date\":\"2019-08-23T16:31:00.000Z\"," + "\"lg\":2," + "\"bytes\":\"dGVzdA==\"," + "\"array\":[\"value-from-array\"]," + "\"nested\":{\"value\":\"set\",\"nested2\":{\"l2\":2}}}", object.toString()); }
@Override public JsonObject apply(final Record record) { return service.visit(new JsonVisitor(singer, service, jsonBuilderFactory), record); }
RecordJsonMapper implements Function<Record, JsonObject> { @Override public JsonObject apply(final Record record) { return service.visit(new JsonVisitor(singer, service, jsonBuilderFactory), record); } }
RecordJsonMapper implements Function<Record, JsonObject> { @Override public JsonObject apply(final Record record) { return service.visit(new JsonVisitor(singer, service, jsonBuilderFactory), record); }  }
RecordJsonMapper implements Function<Record, JsonObject> { @Override public JsonObject apply(final Record record) { return service.visit(new JsonVisitor(singer, service, jsonBuilderFactory), record); }  @Override JsonObject apply(final Record record); }
RecordJsonMapper implements Function<Record, JsonObject> { @Override public JsonObject apply(final Record record) { return service.visit(new JsonVisitor(singer, service, jsonBuilderFactory), record); }  @Override JsonObject apply(final Record record);  }