JsonParserDelegate that allows use of
TokenFilter for outputting a subset of content that
is visible to caller
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | _allowMultipleMatches
Flag that determines whether filtering will continue after the first
match is indicated or not: if `false`, output is based on just the first
full match (returning |
| protected JsonToken | _currToken
Last token retrieved via |
| protected TokenFilterContext | _exposedContext
In cases where |
| protected TokenFilterContext | _headContext
During traversal this is the actual "open" parse tree, which sometimes
is the same as |
| protected TokenFilter. | _inclusion
Flag that determines whether path leading up to included content should also be automatically included or not. |
| protected TokenFilter | _itemFilter
State that applies to the item within container, used where applicable. |
| protected JsonToken | _lastClearedToken
Last cleared token, if any: that is, value that was in
effect when |
| protected int | _matchCount
Number of tokens for which |
| protected TokenFilter | rootFilter
Object consulted to determine whether to write parts of content generator is asked to write or not. |
| Access | Constructor and Description |
|---|---|
| public | FilteringParserDelegate(JsonParser
Parser to delegate calls to p, TokenFilter Filter to use f, TokenFilter.Definition of inclusion criteria inclusion,Whether to allow multiple matches allowMultipleMatches)
|
| public | FilteringParserDelegate(JsonParser
Parser to delegate calls to p, TokenFilter Filter to use f, TokenFilter.Definition of inclusion criteria inclusion,Whether to allow multiple matches allowMultipleMatches, boolean If true, allows use of NonBlockingJsonParser: must
also feed all input to parser before calling nextToken on this delegate allowNonBlockingParser)
|
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| protected TokenStreamContext | |
| private JsonToken | |
| protected final JsonToken | |
| protected final JsonToken | |
| private final boolean | |
| public void | clearCurrentToken()
Overrides tools. Method called to "consume" the current token by effectively
removing it so that |
| public TokenStreamLocation | currentLocation()
Overrides tools. Method that returns location of the last processed character; usually for error reporting purposes. |
| public String | currentName()
Overrides tools. Method that can be called to get the name associated with
the current token: for |
| public JsonToken | currentToken()
Overrides tools. Accessor to find which token parser currently points to, if any; null will be returned if none. |
| public final int | currentTokenId()
Overrides tools. Method similar to |
| public TokenFilter | |
| public JsonToken | getLastClearedToken()
Overrides tools. Method that can be called to get the last token that was
cleared using |
| public int | Returns: Number of matchesAccessor for finding number of matches, where specific token and sub-tree starting (if structured type) are passed. |
| public String | getString()
Overrides tools. Method for accessing textual representation of the current token;
if no current token (before first call to |
| public char[] | getStringCharacters()
Overrides tools. Method similar to |
| public int | getStringLength()
Overrides tools. Accessor used with |
| public int | getStringOffset()
Overrides tools. Accessor used with |
| public String | getValueAsString()
Overrides tools. Method that will try to convert value of current token to a
|
| public String | getValueAsString(String defaultValue)
Overrides tools. Method that will try to convert value of current token to a
|
| public boolean | hasCurrentToken()
Overrides tools. Method for checking whether parser currently points to a token (and data for that token is available). |
| public boolean | hasStringCharacters()
Overrides tools. Method that can be used to determine whether calling of
|
| public final boolean | hasToken(JsonToken t)
Overrides tools. Method that is functionally equivalent to:
|
| public boolean | hasTokenId(int id)
Overrides tools. Method that is functionally equivalent to:
|
| private void | initializeFilters(TokenFilter
Filter to use f, TokenFilter.Definition of inclusion criteria inclusion,Whether to allow multiple matches allowMultipleMatches)Initializes filter-related fields |
| public boolean | isExpectedStartArrayToken()
Overrides tools. Specialized accessor that can be used to verify that the current
token indicates start array (usually meaning that current token
is |
| public boolean | isExpectedStartObjectToken()
Overrides tools. Similar to |
| public String | nextName()
Overrides tools. Method that fetches next token (as if calling |
| public boolean | nextName(SerializableString str)
Overrides tools. Method that fetches next token (as if calling |
| public int | nextNameMatch(PropertyNameMatcher matcher)
Overrides tools. Method that tries to match next token from stream as |
| public JsonToken | nextToken()
Overrides tools. Main iteration method, which will advance stream enough to determine type of the next token, if any. |
| public JsonToken | nextValue()
Overrides tools. Iteration method that will advance stream enough to determine type of the next token that is a value type (including JSON Array and Object start/end markers). |
| public JsonParser | skipChildren()
Overrides tools. Need to override, re-implement similar to how method defined in
|
| public TokenStreamContext | streamReadContext()
Overrides tools. Method that can be used to access current parsing context reader is in. There are 3 different types: root, array and object contexts, with slightly different available information. |
| _allowMultipleMatches | back to summary |
|---|---|
| protected boolean _allowMultipleMatches Flag that determines whether filtering will continue after the first
match is indicated or not: if `false`, output is based on just the first
full match (returning | |
| _currToken | back to summary |
|---|---|
| protected JsonToken _currToken Last token retrieved via | |
| _exposedContext | back to summary |
|---|---|
| protected TokenFilterContext _exposedContext In cases where | |
| _headContext | back to summary |
|---|---|
| protected TokenFilterContext _headContext During traversal this is the actual "open" parse tree, which sometimes
is the same as | |
| _inclusion | back to summary |
|---|---|
| protected TokenFilter. Flag that determines whether path leading up to included content should also be automatically included or not. If `false`, no path inclusion is done and only explicitly included entries are output; if `true` then path from main level down to match is also included as necessary. | |
| _itemFilter | back to summary |
|---|---|
| protected TokenFilter _itemFilter State that applies to the item within container, used where applicable. Specifically used to pass inclusion state between property name and property, and also used for array elements. | |
| _lastClearedToken | back to summary |
|---|---|
| protected JsonToken _lastClearedToken Last cleared token, if any: that is, value that was in
effect when | |
| _matchCount | back to summary |
|---|---|
| protected int _matchCount Number of tokens for which | |
| rootFilter | back to summary |
|---|---|
| protected TokenFilter rootFilter Object consulted to determine whether to write parts of content generator is asked to write or not. | |
| FilteringParserDelegate | back to summary |
|---|---|
public FilteringParserDelegate(JsonParser p, TokenFilter f, TokenFilter.
| |
| FilteringParserDelegate | back to summary |
|---|---|
public FilteringParserDelegate(JsonParser p, TokenFilter f, TokenFilter.
| |
| _checkAsyncParser | back to summary |
|---|---|
| private static void _checkAsyncParser(JsonParser p) throws IllegalArgumentException | |
| _filterContext | back to summary |
|---|---|
| protected TokenStreamContext _filterContext() | |
| _nextBuffered | back to summary |
|---|---|
| private JsonToken _nextBuffered(TokenFilterContext buffRoot) throws JacksonException | |
| _nextToken2 | back to summary |
|---|---|
| protected final JsonToken _nextToken2() throws JacksonException | |
| _nextTokenWithBuffering | back to summary |
|---|---|
| protected final JsonToken _nextTokenWithBuffering(final TokenFilterContext buffRoot) throws JacksonException | |
| _verifyAllowedMatches | back to summary |
|---|---|
| private final boolean _verifyAllowedMatches() throws JacksonException | |
| clearCurrentToken | back to summary |
|---|---|
| public void clearCurrentToken() Overrides tools. Doc from tools. Method called to "consume" the current token by effectively
removing it so that Method was added to be used by the optional data binder, since it has to be able to consume last token used for binding (so that it will not be used again).
| |
| currentLocation | back to summary |
|---|---|
| public TokenStreamLocation currentLocation() Overrides tools. Doc from tools. Method that returns location of the last processed character; usually for error reporting purposes.
Note that the location is not guaranteed to be accurate (although most
implementation will try their best): some implementations may only
report specific boundary locations (start or end locations of tokens)
and others only return
| |
| currentName | back to summary |
|---|---|
| public String currentName() Overrides tools. Doc from tools. Method that can be called to get the name associated with
the current token: for
| |
| currentToken | back to summary |
|---|---|
| public JsonToken currentToken() Overrides tools. Doc from tools. Accessor to find which token parser currently points to, if any; null will be returned if none. If return value is non-null, data associated with the token is available via other accessor methods.
| |
| currentTokenId | back to summary |
|---|---|
| public final int currentTokenId() Overrides tools. Doc from tools. Method similar to Use of int directly is typically more efficient on switch statements, so this method may be useful when building low-overhead codecs. Note, however, that effect may not be big enough to matter: make sure to profile performance before deciding to use this method.
| |
| getFilter | back to summary |
|---|---|
| public TokenFilter getFilter() | |
| getLastClearedToken | back to summary |
|---|---|
| public JsonToken getLastClearedToken() Overrides tools. Doc from tools. Method that can be called to get the last token that was
cleared using
| |
| getMatchCount | back to summary |
|---|---|
| public int getMatchCount() Accessor for finding number of matches, where specific token and sub-tree starting (if structured type) are passed.
| |
| getString | back to summary |
|---|---|
| public String getString() throws JacksonException Overrides tools. Doc from tools. Method for accessing textual representation of the current token;
if no current token (before first call to
| |
| getStringCharacters | back to summary |
|---|---|
| public char[] getStringCharacters() throws JacksonException Overrides tools. Doc from tools. Method similar to
Note that caller MUST NOT modify the returned character array in any way -- doing so may corrupt current parser state and render parser instance useless.
The only reason to call this method (over
| |
| getStringLength | back to summary |
|---|---|
| public int getStringLength() throws JacksonException Overrides tools. Doc from tools. Accessor used with
| |
| getStringOffset | back to summary |
|---|---|
| public int getStringOffset() throws JacksonException Overrides tools. Doc from tools. Accessor used with
| |
| getValueAsString | back to summary |
|---|---|
| public String getValueAsString() throws JacksonException Overrides tools. Doc from tools. Method that will try to convert value of current token to a
| |
| getValueAsString | back to summary |
|---|---|
| public String getValueAsString(String defaultValue) throws JacksonException Overrides tools. Doc from tools. Method that will try to convert value of current token to a
| |
| hasCurrentToken | back to summary |
|---|---|
| public boolean hasCurrentToken() Overrides tools. Doc from tools. Method for checking whether parser currently points to
a token (and data for that token is available).
Equivalent to check for
| |
| hasStringCharacters | back to summary |
|---|---|
| public boolean hasStringCharacters() Overrides tools. Doc from tools. Method that can be used to determine whether calling of
| |
| hasToken | back to summary |
|---|---|
| public final boolean hasToken(JsonToken t) Overrides tools. Doc from tools. Method that is functionally equivalent to:
Note that no traversal or conversion is performed; so in some
cases calling method like
| |
| hasTokenId | back to summary |
|---|---|
| public boolean hasTokenId(int id) Overrides tools. Doc from tools. Method that is functionally equivalent to:
Note that no traversal or conversion is performed; so in some
cases calling method like
| |
| initializeFilters | back to summary |
|---|---|
| private void initializeFilters(TokenFilter f, TokenFilter. Initializes filter-related fields
| |
| isExpectedStartArrayToken | back to summary |
|---|---|
| public boolean isExpectedStartArrayToken() Overrides tools. Doc from tools. Specialized accessor that can be used to verify that the current
token indicates start array (usually meaning that current token
is Default implementation is equivalent to: currentToken() == JsonToken.START_ARRAYbut may be overridden by custom parser implementations.
| |
| isExpectedStartObjectToken | back to summary |
|---|---|
| public boolean isExpectedStartObjectToken() Overrides tools. Doc from tools. Similar to
| |
| nextName | back to summary |
|---|---|
| public String nextName() throws JacksonException Overrides tools. Doc from tools. Method that fetches next token (as if calling Note in Jackson 2.x method was called
| |
| nextName | back to summary |
|---|---|
| public boolean nextName(SerializableString str) throws JacksonException Overrides tools. Doc from tools. Method that fetches next token (as if calling return (nextToken() == JsonToken.PROPERTY_NAME) && str.getValue().equals(currentName());but may be faster for parser to verify, and can therefore be used if caller expects to get such a property name from input next. Note in Jackson 2.x method was called
| |
| nextNameMatch | back to summary |
|---|---|
| public int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException Overrides tools. Doc from tools. Method that tries to match next token from stream as
| |
| nextToken | back to summary |
|---|---|
| public JsonToken nextToken() throws JacksonException Overrides tools. Doc from tools. 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.
| |
| nextValue | back to summary |
|---|---|
| public JsonToken nextValue() throws JacksonException Overrides tools. Doc from tools. Iteration method that will advance stream enough
to determine type of the next token that is a value type
(including JSON Array and Object start/end markers).
Or put another way, nextToken() will be called once,
and if
| |
| skipChildren | back to summary |
|---|---|
| public JsonParser skipChildren() throws JacksonException Overrides tools. Need to override, re-implement similar to how method defined in
| |
| streamReadContext | back to summary |
|---|---|
| public TokenStreamContext streamReadContext() Overrides tools. Doc from tools. Method that can be used to access current parsing context reader is in. There are 3 different types: root, array and object contexts, with slightly different available information. Contexts are hierarchically nested, and can be used for example for figuring out part of the input document that correspond to specific array or object (for highlighting purposes, or error reporting). Contexts can also be used for simple xpath-like matching of input, if so desired. Note method was called
| |