JsonParsers to create a single logical sequence of
tokens, as a single JsonParser.
Fairly simple use of JsonParserDelegate: only need
to override nextToken to handle transition
| Modifier and Type | Field and Description |
|---|---|
| protected final boolean | _checkForExistingToken
Configuration that determines whether state of parsers is first verified
to see if parser already points to a token (that is,
|
| protected boolean | _hasToken
Flag used to indicate that `JsonParser.nextToken()` should not be called, due to parser already pointing to a token. |
| protected int | _nextParserIndex
Index of the next parser in |
| protected final JsonParser[] | _parsers
Parsers other than the first one (which is initially assigned as delegate) |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public void | close()
Overrides com. Implements java. Feature#AUTO_CLOSE_SOURCE is enabled.
|
| public int | Returns: Number of actual underlying parsers this sequence hasMethod that is most useful for debugging or testing; returns actual number of underlying parsers sequence was constructed with (nor just ones remaining active) |
| public static JsonParserSequence | Returns: Sequence instance constructedFlag passed to be assigned as
checkForExistingToken, JsonParser _checkForExistingToken for resulting sequenceFirst parser to traverse first, JsonParser Second parser to traverse second)Method that will construct a sequence (possibly a sequence) that contains all given sub-parsers. |
| public static JsonParserSequence | |
| public JsonToken | nextToken()
Overrides com. |
| public JsonParser | skipChildren()
Overrides com. com., to keep
state correct here.
|
| protected JsonToken | |
| protected boolean | Returns: True if switch succeeded; false otherwiseMethod that will switch active delegate parser from the current one to the next parser in sequence, if there is another parser left: if so, the next parser will become the active delegate parser. |
| _checkForExistingToken | back to summary |
|---|---|
| protected final boolean _checkForExistingToken Configuration that determines whether state of parsers is first verified
to see if parser already points to a token (that is,
Default setting is
| |
| _hasToken | back to summary |
|---|---|
| protected boolean _hasToken Flag used to indicate that `JsonParser.nextToken()` should not be called, due to parser already pointing to a token.
| |
| _nextParserIndex | back to summary |
|---|---|
| protected int _nextParserIndex Index of the next parser in | |
| _parsers | back to summary |
|---|---|
| protected final JsonParser[] _parsers Parsers other than the first one (which is initially assigned as delegate) | |
| JsonParserSequence | back to summary |
|---|---|
| protected JsonParserSequence(JsonParser[] parsers)
Deprecated
| |
| JsonParserSequence | back to summary |
|---|---|
| protected JsonParserSequence(boolean checkForExistingToken, JsonParser[] parsers) | |
| addFlattenedActiveParsers | back to summary |
|---|---|
protected void addFlattenedActiveParsers(List<JsonParser> listToAddIn)
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides com. Implements java. Doc from com. Closes the parser so that no further iteration or data access
can be made; will also close the underlying input source
if parser either owns the input source, or feature
| |
| containedParsersCount | back to summary |
|---|---|
| public int containedParsersCount() Method that is most useful for debugging or testing; returns actual number of underlying parsers sequence was constructed with (nor just ones remaining active)
| |
| createFlattened | back to summary |
|---|---|
| public static JsonParserSequence createFlattened(boolean checkForExistingToken, JsonParser first, JsonParser second) Method that will construct a sequence (possibly a sequence) that contains all given sub-parsers. All parsers given are checked to see if they are sequences: and if so, they will be "flattened", that is, contained parsers are directly added in a new sequence instead of adding sequences within sequences. This is done to minimize delegation depth, ideally only having just a single level of delegation.
| |
| createFlattened | back to summary |
|---|---|
| public static JsonParserSequence createFlattened(JsonParser first, JsonParser second)
Deprecated
| |
| nextToken | back to summary |
|---|---|
| public JsonToken nextToken() throws IOException Overrides com. Doc from com. Main iteration method, which will advance stream enough to determine type of the next token, if any. If none remaining (stream has no content other than possible white space before ending), null will be returned.
| |
| skipChildren | back to summary |
|---|---|
| public JsonParser skipChildren() throws IOException Overrides com. Need to override, re-implement similar to how method defined in
| |
| switchAndReturnNext | back to summary |
|---|---|
| protected JsonToken switchAndReturnNext() throws IOException | |
| switchToNext | back to summary |
|---|---|
| protected boolean switchToNext() Method that will switch active delegate parser from the current one to the next parser in sequence, if there is another parser left: if so, the next parser will become the active delegate parser.
| |