public class JsonPointerBasedFilter extends TokenFilter
TokenFilter
implementation that takes a single
JsonPointer
and matches a single value accordingly.
Instances are immutable and fully thread-safe, shareable,
and efficient to use.TokenFilter.Inclusion
Modifier and Type | Field and Description |
---|---|
protected boolean |
_includeAllElements
If true include all array elements by ignoring the array index match and advancing
the JsonPointer to the next level
|
protected JsonPointer |
_pathToMatch |
INCLUDE_ALL
Constructor and Description |
---|
JsonPointerBasedFilter(JsonPointer pathToMatch) |
JsonPointerBasedFilter(JsonPointer pathToMatch,
boolean includeAllElements) |
JsonPointerBasedFilter(String ptrExpr) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
_includeScalar()
Overridable default implementation delegated to all scalar value
inclusion check methods.
|
protected JsonPointerBasedFilter |
construct(JsonPointer pathToMatch,
boolean includeAllElements)
Overridable factory method use for creating new instances by
default
includeElement(int) and includeProperty(java.lang.String) methods:
needs to be overridden if sub-classing this class. |
TokenFilter |
filterStartArray()
Method called to check whether Array value at current output
location should be included in output.
|
TokenFilter |
filterStartObject()
Method called to check whether Object value at current output
location should be included in output.
|
TokenFilter |
includeElement(int index)
Method called to check whether array element with specified index (zero-based),
at current output location, should be included in output.
|
TokenFilter |
includeProperty(String name)
Method called to check whether property value with specified name,
at current output location, should be included in output.
|
String |
toString() |
filterFinishArray, filterFinishObject, includeBinary, includeBoolean, includeEmbeddedValue, includeEmptyArray, includeEmptyObject, includeNull, includeNumber, includeNumber, includeNumber, includeNumber, includeNumber, includeNumber, includeRawValue, includeRootValue, includeString, includeString, includeValue
protected final JsonPointer _pathToMatch
protected final boolean _includeAllElements
public JsonPointerBasedFilter(String ptrExpr)
public JsonPointerBasedFilter(JsonPointer pathToMatch)
pathToMatch
- Content to extractpublic JsonPointerBasedFilter(JsonPointer pathToMatch, boolean includeAllElements)
pathToMatch
- Content to extractincludeAllElements
- if true array indexes in ptrExpr
are ignored
and all elements will be matched. default: falseprotected JsonPointerBasedFilter construct(JsonPointer pathToMatch, boolean includeAllElements)
includeElement(int)
and includeProperty(java.lang.String)
methods:
needs to be overridden if sub-classing this class.pathToMatch
- Remaining path for filter to matchincludeAllElements
- Whether to just include all array elements
of matching Array-valued path automaticallypublic TokenFilter includeElement(int index)
TokenFilter
null
to indicate that the Array element should be skipped
TokenFilter.INCLUDE_ALL
to indicate that the Array element should be included
completely in output
TokenFilter
implementation (possibly this one) to mean
that further inclusion calls on returned filter object need to be made
as necessary, to determine inclusion.
The default implementation simply returns this
to continue calling
methods on this filter object, without full inclusion or exclusion.
includeElement
in class TokenFilter
index
- Array element index (0-based) to checknull
or TokenFilter.INCLUDE_ALL
(which have simpler semantics)public TokenFilter includeProperty(String name)
TokenFilter
null
to indicate that the property and its value should be skipped
TokenFilter.INCLUDE_ALL
to indicate that the property and its value should be included
completely in output
TokenFilter
implementation (possibly this one) to mean
that further inclusion calls on returned filter object need to be made
as necessary, to determine inclusion.
The default implementation simply returns this
to continue calling
methods on this filter object, without full inclusion or exclusion.
includeProperty
in class TokenFilter
name
- Name of Object property to checknull
or TokenFilter.INCLUDE_ALL
(which have simpler semantics)public TokenFilter filterStartArray()
TokenFilter
null
to indicate that the Array should be skipped
TokenFilter.INCLUDE_ALL
to indicate that the Array should be included
completely in output
TokenFilter
implementation (possibly this one) to mean
that further inclusion calls on return filter object need to be made
on contained element values, as necessary. TokenFilter.filterFinishArray()
will
also be called on returned filter object
Default implementation returns this
, which means that checks
are made recursively for elements of the array to determine possible inclusion.
filterStartArray
in class TokenFilter
null
or TokenFilter.INCLUDE_ALL
(which have simpler semantics)public TokenFilter filterStartObject()
TokenFilter
null
to indicate that the Object should be skipped
TokenFilter.INCLUDE_ALL
to indicate that the Object should be included
completely in output
TokenFilter
implementation (possibly this one) to mean
that further inclusion calls on return filter object need to be made
on contained properties, as necessary. TokenFilter.filterFinishObject()
will
also be called on returned filter object
Default implementation returns this
, which means that checks
are made recursively for properties of the Object to determine possible inclusion.
filterStartObject
in class TokenFilter
null
or TokenFilter.INCLUDE_ALL
(which have simpler semantics)protected boolean _includeScalar()
TokenFilter
_includeScalar
in class TokenFilter
true
)
or not (false
)public String toString()
toString
in class TokenFilter
Copyright © 2008–2023 FasterXML. All rights reserved.