johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: JsonGenerator chaining enforced
Date Fri, 27 Jun 2014 17:30:28 GMT
should be fixed



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 19:16 GMT+02:00 Romain Manni-Bucau <rmannibucau@gmail.com>:

> Would have expected JsonGeneratorFacade (no generics) and new JsonGeneratorFacade(gesonGeneratorImpl/*
> pretty or not */)
>
> but yes you got the idea otheriwse. I have few cycles now (I'm on IRC if
> you want) so trying to fix it in the coming hour.
>
>
>
> 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 18:12 GMT+02:00 Hendrik Dev <hendrikdev22@gmail.com>:
>
> 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
>> <rmannibucau@gmail.com> 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 <hendrikdev22@gmail.com>:
>> >
>> >> 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
>> >>
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message