java.lang.Object
tools.jackson.core.filter.TokenFilter
tools.jackson.core.filter.JsonPointerBasedFilter
Simple
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.- Since:
- 2.6
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.core.filter.TokenFilter
TokenFilter.Inclusion -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanIf true include all array elements by ignoring the array index match and advancing the JsonPointer to the next levelprotected final JsonPointerFields inherited from class tools.jackson.core.filter.TokenFilter
INCLUDE_ALL -
Constructor Summary
ConstructorsConstructorDescriptionJsonPointerBasedFilter(String ptrExpr) JsonPointerBasedFilter(JsonPointer pathToMatch) JsonPointerBasedFilter(JsonPointer pathToMatch, boolean includeAllElements) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanOverridable default implementation delegated to all scalar value inclusion check methods.protected JsonPointerBasedFilterconstruct(JsonPointer pathToMatch, boolean includeAllElements) Overridable factory method use for creating new instances by defaultincludeElement(int)andincludeProperty(java.lang.String)methods: needs to be overridden if sub-classing this class.Method called to check whether Array value at current output location should be included in output.Method called to check whether Object value at current output location should be included in output.includeElement(int index) Method called to check whether array element with specified index (zero-based), at current output location, should be included in output.includeProperty(String name) Method called to check whether property value with specified name, at current output location, should be included in output.toString()Methods inherited from class tools.jackson.core.filter.TokenFilter
filterFinishArray, filterFinishObject, includeBinary, includeBoolean, includeEmbeddedValue, includeEmptyArray, includeEmptyObject, includeNull, includeNumber, includeNumber, includeNumber, includeNumber, includeNumber, includeNumber, includeRawValue, includeRootValue, includeString, includeString, includeValue
-
Field Details
-
_pathToMatch
-
_includeAllElements
protected final boolean _includeAllElementsIf true include all array elements by ignoring the array index match and advancing the JsonPointer to the next level- Since:
- 2.16
-
-
Constructor Details
-
JsonPointerBasedFilter
-
JsonPointerBasedFilter
- Parameters:
pathToMatch- Content to extract
-
JsonPointerBasedFilter
- Parameters:
pathToMatch- Content to extractincludeAllElements- if true array indexes inptrExprare ignored and all elements will be matched. default: false- Since:
- 2.16
-
-
Method Details
-
construct
Overridable factory method use for creating new instances by defaultincludeElement(int)andincludeProperty(java.lang.String)methods: needs to be overridden if sub-classing this class.- Parameters:
pathToMatch- Remaining path for filter to matchincludeAllElements- Whether to just include all array elements of matching Array-valued path automatically- Returns:
- Filter constructed
-
includeElement
Description copied from class:TokenFilterMethod called to check whether array element with specified index (zero-based), at current output location, should be included in output. Three kinds of return values may be used as follows:nullto indicate that the Array element should be skippedTokenFilter.INCLUDE_ALLto indicate that the Array element should be included completely in output- Any other
TokenFilterimplementation (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
thisto continue calling methods on this filter object, without full inclusion or exclusion.- Overrides:
includeElementin classTokenFilter- Parameters:
index- Array element index (0-based) to check- Returns:
- TokenFilter to use for further calls within element value, unless return value
is
nullorTokenFilter.INCLUDE_ALL(which have simpler semantics)
-
includeProperty
Description copied from class:TokenFilterMethod called to check whether property value with specified name, at current output location, should be included in output. Three kinds of return values may be used as follows:nullto indicate that the property and its value should be skippedTokenFilter.INCLUDE_ALLto indicate that the property and its value should be included completely in output- Any other
TokenFilterimplementation (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
thisto continue calling methods on this filter object, without full inclusion or exclusion.- Overrides:
includePropertyin classTokenFilter- Parameters:
name- Name of Object property to check- Returns:
- TokenFilter to use for further calls within property value, unless return value
is
nullorTokenFilter.INCLUDE_ALL(which have simpler semantics)
-
filterStartArray
Description copied from class:TokenFilterMethod called to check whether Array value at current output location should be included in output. Three kinds of return values may be used as follows:nullto indicate that the Array should be skippedTokenFilter.INCLUDE_ALLto indicate that the Array should be included completely in output- Any other
TokenFilterimplementation (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.- Overrides:
filterStartArrayin classTokenFilter- Returns:
- TokenFilter to use for further calls within Array, unless return value
is
nullorTokenFilter.INCLUDE_ALL(which have simpler semantics)
-
filterStartObject
Description copied from class:TokenFilterMethod called to check whether Object value at current output location should be included in output. Three kinds of return values may be used as follows:nullto indicate that the Object should be skippedTokenFilter.INCLUDE_ALLto indicate that the Object should be included completely in output- Any other
TokenFilterimplementation (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.- Overrides:
filterStartObjectin classTokenFilter- Returns:
- TokenFilter to use for further calls within Array, unless return value
is
nullorTokenFilter.INCLUDE_ALL(which have simpler semantics)
-
_includeScalar
protected boolean _includeScalar()Description copied from class:TokenFilterOverridable default implementation delegated to all scalar value inclusion check methods. The default implementation simply includes all leaf values.- Overrides:
_includeScalarin classTokenFilter- Returns:
- Whether all leaf scalar values should be included (
true) or not (false)
-
toString
- Overrides:
toStringin classTokenFilter
-