Top Description Fields Constructors Methods
com.fasterxml.jackson.core.filter

public Class FilteringParserDelegate

extends JsonParserDelegate
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.math.BigDecimal, .BigInteger, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.filter.TokenFilter.Inclusion, com.fasterxml.jackson.core.util.JsonParserDelegate

Specialized JsonParserDelegate that allows use of TokenFilter for outputting a subset of content that is visible to caller
Since
2.6

Field Summary

Modifier and TypeField 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 TokenFilter#INCLUDE_ALL) and no more checks are made; if `true` then filtering will be applied as necessary until end of content.

protected JsonToken
_currToken

Last token retrieved via nextToken, if any.

protected TokenFilterContext
_exposedContext

In cases where _headContext is "ahead" of context exposed to caller, this context points to what is currently exposed to caller.

protected TokenFilterContext
_headContext

During traversal this is the actual "open" parse tree, which sometimes is the same as _exposedContext, and at other times is ahead of it.

protected TokenFilter.Inclusion
_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 clearCurrentToken was called.

protected int
_matchCount

Number of tokens for which TokenFilter#INCLUDE_ALL has been returned.

protected TokenFilter
rootFilter

Object consulted to determine whether to write parts of content generator is asked to write or not.

Inherited from com.fasterxml.jackson.core.util.JsonParserDelegate:
delegate

Constructor Summary

AccessConstructor and Description
public
FilteringParserDelegate(JsonParser p, TokenFilter f, boolean includePath, boolean allowMultipleMatches)
Deprecated

public
FilteringParserDelegate(JsonParser
Parser to delegate calls to
p
,
TokenFilter
Filter to use
f
,
TokenFilter.Inclusion
Definition of inclusion criteria
inclusion
,
boolean
Whether to allow multiple matches
allowMultipleMatches
)

Method Summary

Modifier and TypeMethod and Description
protected JsonStreamContext
private JsonToken
protected final JsonToken
protected final JsonToken
private final boolean
public void
clearCurrentToken()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.clearCurrentToken.

Method called to "consume" the current token by effectively removing it so that hasCurrentToken returns false, and getCurrentToken null).

public JsonLocation
currentLocation()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.currentLocation.

Method that returns location of the last processed input unit (character or byte) from the input; usually for error reporting purposes.

public String
currentName()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.currentName.

Method that can be called to get the name associated with the current token: for JsonToken#FIELD_NAMEs it will be the same as what getText returns; for field values it will be preceding field name; and for others (array values, root-level values) null.

public JsonToken
currentToken()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.currentToken.

Accessor to find which token parser currently points to, if any; null will be returned if none.

public final int
currentTokenId()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.currentTokenId.

Method similar to getCurrentToken() but that returns an int instead of JsonToken (enum value).

public JsonLocation
currentTokenLocation()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.currentTokenLocation.

Method that return the starting location of the current (most recently returned) token; that is, the position of the first input unit (character or byte) from input that starts the current token.

public BigInteger
getBigIntegerValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getBigIntegerValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can not be used as a Java long primitive type due to its magnitude.

public byte[]
getBinaryValue(Base64Variant
Expected variant of base64 encoded content (see Base64Variants for definitions of "standard" variants).
b64variant
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getBinaryValue.

Method that can be used to read (and consume -- results may not be accessible using other methods after the call) base64-encoded binary data included in the current textual JSON value.

public boolean
getBooleanValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getBooleanValue.

Convenience accessor that can be called when the current token is JsonToken#VALUE_TRUE or JsonToken#VALUE_FALSE, to return matching boolean value.

public byte
getByteValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getByteValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a value of Java byte primitive type.

public JsonLocation
getCurrentLocation()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getCurrentLocation.

Deprecated

Deprecated alias for currentLocation() (removed from Jackson 3.0).

public String
public JsonToken
getCurrentToken()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getCurrentToken.

Deprecated

Alias for currentToken(), may be deprecated sometime after Jackson 2.13 (will be removed from 3.0).

public final int
public BigDecimal
getDecimalValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getDecimalValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT or JsonToken#VALUE_NUMBER_INT.

public double
getDoubleValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getDoubleValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT and it can be expressed as a Java double primitive type.

public Object
getEmbeddedObject()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getEmbeddedObject.

Accessor that can be called if (and only if) the current token is JsonToken#VALUE_EMBEDDED_OBJECT.

public TokenFilter
public float
getFloatValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getFloatValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT and it can be expressed as a Java float primitive type.

public int
getIntValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getIntValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a value of Java int primitive type.

public JsonToken
getLastClearedToken()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getLastClearedToken.

Method that can be called to get the last token that was cleared using clearCurrentToken.

public long
getLongValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getLongValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a Java long primitive type.

public int

Returns:

Number of matches
getMatchCount
()

Accessor for finding number of matches, where specific token and sub-tree starting (if structured type) are passed.

public JsonParser.NumberType
getNumberType()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getNumberType.

If current token is of type JsonToken#VALUE_NUMBER_INT or JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberType constants; otherwise returns null.

public Number
getNumberValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getNumberValue.

Generic number value accessor method that will work for all kinds of numeric values.

public JsonStreamContext
getParsingContext()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getParsingContext.

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.

public short
getShortValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getShortValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a value of Java short primitive type.

public String
getText()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getText.

Method for accessing textual representation of the current token; if no current token (before first call to nextToken, or after encountering end-of-input), returns null.

public char[]
getTextCharacters()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getTextCharacters.

Method similar to getText, but that will return underlying (unmodifiable) character array that contains textual value, instead of constructing a String object to contain this information.

public int
getTextLength()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getTextLength.

Accessor used with getTextCharacters, to know length of String stored in returned buffer.

public int
getTextOffset()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getTextOffset.

Accessor used with getTextCharacters, to know offset of the first text content character within buffer.

public JsonLocation
getTokenLocation()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getTokenLocation.

Deprecated

Deprecated alias for currentTokenLocation() (removed from Jackson 3.0).

public boolean
getValueAsBoolean()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsBoolean.

Method that will try to convert value of current token to a boolean.

public boolean
getValueAsBoolean(boolean
Default value to return if conversion to boolean is not possible
defaultValue
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsBoolean.

Method that will try to convert value of current token to a boolean.

public double
getValueAsDouble()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsDouble.

Method that will try to convert value of current token to a Java double.

public double
getValueAsDouble(double
Default value to return if conversion to double is not possible
defaultValue
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsDouble.

Method that will try to convert value of current token to a Java double.

public int
getValueAsInt()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsInt.

Method that will try to convert value of current token to a Java int value.

public int
getValueAsInt(int
Default value to return if conversion to int is not possible
defaultValue
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsInt.

Method that will try to convert value of current token to a int.

public long
getValueAsLong()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsLong.

Method that will try to convert value of current token to a long.

public long
getValueAsLong(long
Default value to return if conversion to long is not possible
defaultValue
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsLong.

Method that will try to convert value of current token to a long.

public String
getValueAsString()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsString.

Method that will try to convert value of current token to a java.lang.String.

public String
getValueAsString(String
Default value to return if conversion to String is not possible
defaultValue
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.getValueAsString.

Method that will try to convert value of current token to a java.lang.String.

public boolean
hasCurrentToken()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.hasCurrentToken.

Method for checking whether parser currently points to a token (and data for that token is available).

public boolean
hasTextCharacters()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.hasTextCharacters.

Method that can be used to determine whether calling of getTextCharacters would be the most efficient way to access textual content for the event parser currently points to.

public final boolean
hasToken(JsonToken
Token to match
t
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.hasToken.

Method that is functionally equivalent to: return currentToken() == t but may be more efficiently implemented.

public boolean
hasTokenId(int
Token id to match (from (@link JsonTokenId})
id
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.hasTokenId.

Method that is functionally equivalent to: return currentTokenId() == id but may be more efficiently implemented.

public boolean
isExpectedStartArrayToken()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.isExpectedStartArrayToken.

Specialized accessor that can be used to verify that the current token indicates start array (usually meaning that current token is JsonToken#START_ARRAY) when start array is expected.

public boolean
public JsonToken
nextToken()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.nextToken.

Main iteration method, which will advance stream enough to determine type of the next token, if any.

public JsonToken
nextValue()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.nextValue.

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 void
overrideCurrentName(String
Name to use as the current name; may be null.
name
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.overrideCurrentName.

Method that can be used to change what is considered to be the current (field) name.

public int
readBinaryValue(Base64Variant
base64 variant to use
b64variant
,
OutputStream
Output stream to use for passing decoded binary data
out
)

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.readBinaryValue.

Similar to readBinaryValue(OutputStream) but allows explicitly specifying base64 variant to use.

public JsonParser
skipChildren()

Overrides com.fasterxml.jackson.core.util.JsonParserDelegate.skipChildren.

Need to override, re-implement similar to how method defined in com.fasterxml.jackson.core.base.ParserMinimalBase, to keep state correct here.

Inherited from com.fasterxml.jackson.core.util.JsonParserDelegate:
assignCurrentValuecanReadObjectIdcanReadTypeIdcanUseSchemaclosecurrentValuedelegatedisableenablefinishTokengetCodecgetCurrentValuegetFeatureMaskgetInputSourcegetNumberValueDeferredgetNumberValueExactgetObjectIdgetReadCapabilitiesgetSchemagetTextgetTypeIdisClosedisEnabledisExpectedNumberIntTokenisNaNoverrideFormatFeaturesoverrideStdFeaturesrequiresCustomCodecsetCodecsetCurrentValuesetFeatureMasksetSchemastreamReadConstraintsversion