jsr367-experts@jsonb-spec.java.net

[jsr367-experts] Re: Appendable/Readable vs Writer/Reader

From: Romain Manni-Bucau <rmannibucau_at_tomitribe.com>
Date: Wed, 13 Jan 2016 16:02:32 +0100

maybe I looked too quickly but several ~StringBuffer structures are not
writer/reader but appendable/readable so I think it can make sense
sometimes, that said the wrapper is not highly complex so it can be done
outside of jsonb if needed.


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau

2016-01-13 15:59 GMT+01:00 Dmitry Kornilov <dmitry.kornilov_at_oracle.com>:

> So if a passed parameter is an instance of Writer/Reader you pass it
> through as it is (just cast) and it it’s not you wrap it into
> Writer/Reader. It would work.
>
> but
>
> I am wondering how often users are passing implementations of Appendable
> and Readable other than Writer and Reader. I see as a really rare case.
> Another point is that Writer/Reader parameters are widely used in other
> standards such as JSONP and JAXB. I think it’s a good idea to do it the
> same way.
>
> Dmitry
>
> On 13 Jan 2016, at 15:12, Romain Manni-Bucau <rmannibucau_at_tomitribe.com>
> wrote:
>
> In Johnzon we wrap them if we don't know the type (isInstance()) otherwise
> we just cast them which means in practise - "real life" - we'll almost
> never use the wrapper but we don't prevent the user to rely on it if
> needed. Why not doing the same in the RI? It allows few more input/output
> which can be nice for some usages (not runtime but one time init or test
> ones).
>
>
> Romain Manni-Bucau
> @rmannibucau
> http://www.tomitribe.com
> http://rmannibucau.wordpress.com
> https://github.com/rmannibucau
>
> 2016-01-13 15:07 GMT+01:00 <dmitry.kornilov_at_oracle.com>:
>
>> Hi,
>>
>> During our work on RI we realised that using Appendable / Readable in
>> Jsonb.toJson/fromJson methods is not convenient.
>>
>> We are using JSONP as a parser. JSONP uses java.io.Writer and
>> java.io.Reader instead of Appendable and Readable. It means that we
>> need to wrap Appendable/Readable parameters to Writer/Reader before
>> passing it to JSONP. Such a wrap appears redundant to me. It’s also not
>> a best solution from the performance point of view.
>>
>> I am suggesting replacing Appendable/Readable in JSONB to Writer and
>> Reader as it is in JSONP unless there is a strong reason to leave it as
>> it is now.
>>
>> Thanks,
>> Dmitry
>
>
>
>