Skip to main content

[jsr353-experts] Re: JSON_PROCESSING_SPEC-40: JsonBuilder and JsonReader should be interfaces

  • From: Jörn Horstmann < >
  • To:
  • Subject: [jsr353-experts] Re: JSON_PROCESSING_SPEC-40: JsonBuilder and JsonReader should be interfaces
  • Date: Fri, 11 Jan 2013 23:24:20 +0100

My preference would be for 4, interfaces and factories for all parts of the api, leaving the interaction between these classes to the implementation. There would also be no model implementations inside the api module.

The idea behind making JsonParser and interface was to allow switching to a more performant parser. If this performance benefit is negated by the neccessary lookup code, and additional factories are seen as too complicated, then maybe another option would be to remove this pluggability and make everything part of the api module. The model classes could then also be truly immutable final classes.

But such a decision requires more discussion from eg members and possible implementors.

Jörn

On 01/11/2013 08:49 PM, Jitendra Kotamraju wrote:
I think we have quite a bit of discussion on this in the mailing lists.
The issue[1] has all the pointers of discussion. Let me summarize the
options:

1. Leave as it is. Developers would be using new JsonReader(), new
JsonWriter(), new JsonObjectBuilder()/new JsonArrayBuilder(). An
implementation detail is to implement caching of provider in the API.

2. JsonReader/JsonWriter will have additional constructors that take
provider.

3. Introduce JsonReaderFactory/JsonWriterFactory and make
JsonReader/JsonWriter as interfaces.
Also Json.createReader(), Json.createWriter() for common cases. But we
need to see how this works out with Json class as it may become
kitchen-sink.

4. Option 3 + Json.createObjectBuilder() and Json.createArrayBuilder()
(may be factories for them as well).

5. Any ??

Let us resolve this issue soon as it may involve many changes.

Jitu
[1] http://java.net/jira/browse/JSON_PROCESSING_SPEC-40




[jsr353-experts] JSON_PROCESSING_SPEC-40: JsonBuilder and JsonReader should be interfaces

Jitendra Kotamraju 01/11/2013

[jsr353-experts] Re: JSON_PROCESSING_SPEC-40: JsonBuilder and JsonReader should be interfaces

Jörn Horstmann 01/11/2013

[jsr353-experts] Re: [json-processing-spec users] Re: JSON_PROCESSING_SPEC-40: JsonBuilder and JsonReader should be interfaces

Jitendra Kotamraju 01/11/2013
 
 
Close
loading
Please Confirm
Close