users@jsonb-spec.java.net

[jsonb-spec users] [jsr367-experts] Re: [2-DefaultMapping] Proposal

From: Martin Grebac <martin.grebac_at_oracle.com>
Date: Mon, 16 Mar 2015 13:58:21 +0100

On 13.03.15 19:59, Inderjeet Singh wrote:
> On Fri, Mar 13, 2015 at 10:56 AM, Eugen Cepoi <cepoi.eugen_at_gmail.com
> <mailto:cepoi.eugen_at_gmail.com>> wrote:
>
>
>
> 2015-03-13 18:43 GMT+01:00 Inderjeet Singh
> <inder_at_alumni.stanford.edu <mailto:inder_at_alumni.stanford.edu>>:
>
> I think fromJson(File) is unnecessary and should be removed.
> Even fromJson(InputStream) is supect, but I guess InputStreams
> are still all too common.
>
>
> I think it is good to keep InputStream, most of the time we deal
> with inputstream or byte arrays.
>
> toJson(..., Appendable appendable) should be better than Writer().
>
>
> Hum, writer allows to write array of chars, obtaining a
> charsequence from an array of chars would degrade impls don't you
> agree?
>
>
> In Gson, we check if the Appendable is a Writer, if not, we wrap it
> with an AppendableWriter object.
> Internal implementation shouldn't pollute the API.
Do you also suggest Readable instead of Reader as well?
  MartiNG


> Get rid of toJson(..., writer), toJson(..., File) and
> toJson(..., OutputStream)
>
>
> File I don't care, but disagree for OS.
>
>
> In Gson, we don't provide support for InputStream/OutputStream. Not
> have had a single person complain about it so far.
> new InputStreamReader(inputStream) works fine. Same goes for OutputStream.
>
> Why complicate Jsonb API with unnecessary clutter.
>
>
> A powerful (and very useful) feature of Gson is custom type
> adapters. How will that be done in Jsonb.
>
>
> I guess it will be achieved via a similar mechanism as the type
> adapters in JAXB?
>
>
> Which annotation in Jaxb for that?
> In Gson, we cared a lot about a non-annotation way as well since
> classes in third-party libraries or JDK can't be annotated. What's
> your thought on that?
>
> Inder

-- 
Martin Grebac, SW Engineering Manager
Oracle Czech, Prague