Skip to main content

[json-processing-spec users] Re: Remaining work in JsonParser

  • From: Eugen Cepoi < >
  • To:
  • Subject: [json-processing-spec users] Re: Remaining work in JsonParser
  • Date: Wed, 21 Nov 2012 11:49:31 +0100



2012/11/21 Jitendra Kotamraju < " target="_blank"> >
I am working on incorporating the all the discussed changes and make a draft ready for public review phase. In the meantime, I want to make some progress on the JsonParser changes that were discussed in various threads. Let me know if we want to consider any of these.

* iterator() gives iterator of events. But these events are *not* self-contained items like Map.Entry, so that looks odd to call some methods on parser object and some methods on iterator object.
Since this more of cursor API (rather than iterator), should we consider two separate methods ?

boolean advance() instead of hasNext()
Event getEvent() instead of next()


advance? Do you mean that when calling this method, it would consume the next event or return false if it is the end?
Then getEvent would just return current event?

I think hasNext and next are OK. Commonly used names most people are familiar with.
 
* incremental processing of strings that are large. Some of you felt this is useful.

* matchName(String)
May be used for performance. I don't want to consider other match methods that match both name and value

* skipValue()
This is primarily a convenience method and can be implemented using other methods. So should we consdier this ?


When using streaming api it is very useful. It allows you to skip efficiently complex values (obj/arr).
 
* We have a JIRA issue, that moves the cursor to certain place and creates a corresponding
JsonValue

/*
getJsonValue(JsonObject.class) is valid in START_OBJECT state, moves cursor to END_OBJECT
getJsonValue(JsonArray.class) is valid in START_ARRAY state, moves cursor to END_ARRAY
getJsonValue(JsonString.class) is valid in VALUE_STRING state
getJsonValue(JsonNumber.class) is valid in VALUE_NUMBER state
and other values
*/
public <T extends JsonValue> T getJsonValue(Class<T> clazz)

If you have any feedback, let me know.

Jitu



It might be usefull to have a method enclosingScope() that would return possible values ROOT/EMPTY, ARRAY, OBJECT.

Eugen


[json-processing-spec users] Remaining work in JsonParser

Jitendra Kotamraju 11/21/2012

[json-processing-spec users] [jsr353-experts] Re: Remaining work in JsonParser

Jörn Horstmann 11/21/2012

[json-processing-spec users] [jsr353-experts] Re: Re: Remaining work in JsonParser

Jitendra Kotamraju 11/21/2012

[json-processing-spec users] [jsr353-experts] Re: Re: Remaining work in JsonParser

Jörn Horstmann 11/21/2012

[json-processing-spec users] [jsr353-experts] Re: Re: Re: Remaining work in JsonParser

Jitendra Kotamraju 11/26/2012

[json-processing-spec users] Re: Remaining work in JsonParser

Eugen Cepoi 11/21/2012

[json-processing-spec users] Re: Remaining work in JsonParser

Tatu Saloranta 11/21/2012

[json-processing-spec users] Re: Remaining work in JsonParser

Jitendra Kotamraju 11/21/2012

[json-processing-spec users] Re: Remaining work in JsonParser

Tatu Saloranta 11/21/2012

[json-processing-spec users] Re: Remaining work in JsonParser

Jitendra Kotamraju 11/26/2012
 
 
Close
loading
Please Confirm
Close