sure maybe something like this: https://github.com/salyh/fleece_tmp/commit/2dbb1dfb2f728a32ffcbf804d5e7dae3bea18558
On Fri, Jun 27, 2014 at 5:36 PM, Romain Manni-Bucau <[email protected]> wrote: > Yes this is the case (see the mapper impl). > > But you are right. Spec mandates it to be a single instance. > > I think the easiest will be to get a JsonGeneratorFacade delegate to > JsonGenerateImpl (names are just to give the idea). Wouldn't need a lot of > dev. > > Do you want to have a try? > > > > Romain Manni-Bucau > Twitter: @rmannibucau > Blog: http://rmannibucau.wordpress.com/ > LinkedIn: http://fr.linkedin.com/in/rmannibucau > Github: https://github.com/rmannibucau > > > 2014-06-27 17:34 GMT+02:00 Hendrik Dev <[email protected]>: > >> Hi, >> >> don't know if this is an issue but it seems that the JsonGenerator >> must be used in fluent/chaining style: >> >> >> @Test >> public void generateChain() { >> final ByteArrayOutputStream baos = new ByteArrayOutputStream(); >> final JsonGenerator generator = Json.createGenerator(baos); >> generator.writeStartObject().write("firstName", >> "John").writeEnd().close(); >> assertEquals("{\"firstName\":\"John\"}", new >> String(baos.toByteArray())); >> } //this testcase works well >> >> @Test >> public void generateNonChain() { >> final ByteArrayOutputStream baos = new ByteArrayOutputStream(); >> final JsonGenerator generator = Json.createGenerator(baos); >> generator.writeStartObject(); >> generator.write("firstName", "John"); >> generator.writeEnd(); >> generator.close(); >> assertEquals("{\"firstName\":\"John\"}", new >> String(baos.toByteArray())); >> } //this fails because of a leading and dangling comma >> >> API spec say: -can- be chained >> >> Thanks >> Hendrik >>
