[JSON_PROCESSING_SPEC-40] JsonBuilder and JsonReader should be interfaces Created: 11/Dec/12 Updated: 04/Feb/13 Resolved: 04/Feb/13
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
The current design limits possible performance improvements that could be obtained by custom parser implementations. A cleaner design would let the implementation provide both parser and object model implementations that are better integrated and higher performing.
If we implement http://java.net/jira/browse/JSON_PROCESSING_SPEC-9 a json structure could consist of a mix between implementations from the api package and implementation defined classes.
Builders would be created by static methods of the Json class or a JsonBuilderFactory created via the Json class.
|Comment by jitu [ 12/Dec/12 ]|
Since JsonParser/JsonGenerator are already used by JsonReader/JsonGenerator, most of the performance improvements are available from a provider. Perhpas, the remaining improvements for JsonString/JsonNumber impl may not be much.
The high-level API should more usable than the low-level API, i.e new JsonArrayBuilder() etc is more user friendly.
Otherwise, a possible approach is to introduce
|Comment by wenshao [ 13/Dec/12 ]|
i can not understand why not be interfaces?
not just these two, should be interfaces include following:
|Comment by jhorstmann [ 07/Jan/13 ]|
The current design, with only JsonParser as an implementation provided class, also seems to have performance problems of its own due to repeated ServiceLoader lookup. With JsonReader as an interface and a threadsafe JsonReaderFactory these lookups can be avoided.
|Comment by jitu [ 09/Jan/13 ]|
One suggestion was to cache the provider so that there won't be service lookup costs for each JsonReader/JsonWriter. The cache strategy that is suggested is:
|Comment by jitu [ 04/Feb/13 ]|
Made JsonReader, JsonWriter, JsonArrayWriter, JsonObjectWriter as interfaces.
Added methods to create these objects as well as the factory classes.