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

public Class JsonPointerBasedFilter

extends TokenFilter
Class Inheritance
Imports
com.fasterxml.jackson.core.JsonPointer

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

Field Summary

Modifier and TypeField and Description
protected final boolean
_includeAllElements

If true include all array elements by ignoring the array index match and advancing the JsonPointer to the next level

protected final JsonPointer
Inherited from com.fasterxml.jackson.core.filter.TokenFilter:
INCLUDE_ALL

Constructor Summary

AccessConstructor and Description
public
public
JsonPointerBasedFilter(JsonPointer
Content to extract
pathToMatch
)

public
JsonPointerBasedFilter(JsonPointer
Content to extract
pathToMatch
,
boolean
if true array indexes in ptrExpr are ignored and all elements will be matched. default: false
includeAllElements
)

Method Summary

Modifier and TypeMethod and Description
protected boolean
_includeScalar()

Overrides com.fasterxml.jackson.core.filter.TokenFilter._includeScalar.

Overridable default implementation delegated to all scalar value inclusion check methods.

protected JsonPointerBasedFilter

Returns:

Constructed filter
construct
(JsonPointer
Remaining path for filter to match
pathToMatch
,
boolean
Whether to just include all array elements of matching Array-valued path automatically
includeAllElements
)

Overridable factory method use for creating new instances by default includeElement and includeProperty methods: needs to be overridden if sub-classing this class.

public TokenFilter
filterStartArray()

Overrides com.fasterxml.jackson.core.filter.TokenFilter.filterStartArray.

Method called to check whether Array value at current output location should be included in output.

public TokenFilter
filterStartObject()

Overrides com.fasterxml.jackson.core.filter.TokenFilter.filterStartObject.

Method called to check whether Object value at current output location should be included in output.

public TokenFilter
includeElement(int
Array element index (0-based) to check
index
)

Overrides com.fasterxml.jackson.core.filter.TokenFilter.includeElement.

Method called to check whether array element with specified index (zero-based), at current output location, should be included in output.

public TokenFilter
includeProperty(String
Name of Object property to check
name
)

Overrides com.fasterxml.jackson.core.filter.TokenFilter.includeProperty.

Method called to check whether property value with specified name, at current output location, should be included in output.

public String
toString()

Overrides com.fasterxml.jackson.core.filter.TokenFilter.toString.

Returns a string representation of the object.

Inherited from com.fasterxml.jackson.core.filter.TokenFilter:
filterFinishArrayfilterFinishObjectincludeBinaryincludeBooleanincludeEmbeddedValueincludeEmptyArrayincludeEmptyObjectincludeNullincludeNumberincludeNumberincludeNumberincludeNumberincludeNumberincludeNumberincludeRawValueincludeRootValueincludeStringincludeStringincludeValue

Field Detail

_includeAllElementsback to summary
protected final boolean _includeAllElements

If true include all array elements by ignoring the array index match and advancing the JsonPointer to the next level

Since
2.16
_pathToMatchback to summary
protected final JsonPointer _pathToMatch

Constructor Detail

JsonPointerBasedFilterback to summary
public JsonPointerBasedFilter(String ptrExpr)
JsonPointerBasedFilterback to summary
public JsonPointerBasedFilter(JsonPointer pathToMatch)
Parameters
pathToMatch:JsonPointer

Content to extract

JsonPointerBasedFilterback to summary
public JsonPointerBasedFilter(JsonPointer pathToMatch, boolean includeAllElements)
Parameters
pathToMatch:JsonPointer

Content to extract

includeAllElements:boolean

if true array indexes in ptrExpr are ignored and all elements will be matched. default: false

Since
2.16

Method Detail

_includeScalarback to summary
protected boolean _includeScalar()

Overrides com.fasterxml.jackson.core.filter.TokenFilter._includeScalar.

Doc from com.fasterxml.jackson.core.filter.TokenFilter._includeScalar.

Overridable default implementation delegated to all scalar value inclusion check methods. The default implementation simply includes all leaf values.

Returns:boolean

Whether all leaf scalar values should be included (true) or not (false)

Annotations
@Override
constructback to summary
protected JsonPointerBasedFilter construct(JsonPointer pathToMatch, boolean includeAllElements)

Overridable factory method use for creating new instances by default includeElement and includeProperty methods: needs to be overridden if sub-classing this class.

Parameters
pathToMatch:JsonPointer

Remaining path for filter to match

includeAllElements:boolean

Whether to just include all array elements of matching Array-valued path automatically

Returns:JsonPointerBasedFilter

Constructed filter

Since
2.16
filterStartArrayback to summary
public TokenFilter filterStartArray()

Overrides com.fasterxml.jackson.core.filter.TokenFilter.filterStartArray.

Doc from com.fasterxml.jackson.core.filter.TokenFilter.filterStartArray.

Method 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:

  • null to indicate that the Array should be skipped
  • INCLUDE_ALL to indicate that the Array should be included completely in output
  • Any other 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. 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.

Returns:TokenFilter

TokenFilter to use for further calls within Array, unless return value is null or INCLUDE_ALL (which have simpler semantics)

Annotations
@Override
filterStartObjectback to summary
public TokenFilter filterStartObject()

Overrides com.fasterxml.jackson.core.filter.TokenFilter.filterStartObject.

Doc from com.fasterxml.jackson.core.filter.TokenFilter.filterStartObject.

Method 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:

  • null to indicate that the Object should be skipped
  • INCLUDE_ALL to indicate that the Object should be included completely in output
  • Any other TokenFilter implementation (possibly this one) to mean that further inclusion calls on return filter object need to be made on contained properties, as necessary. 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.

Returns:TokenFilter

TokenFilter to use for further calls within Array, unless return value is null or INCLUDE_ALL (which have simpler semantics)

Annotations
@Override
includeElementback to summary
public TokenFilter includeElement(int index)

Overrides com.fasterxml.jackson.core.filter.TokenFilter.includeElement.

Doc from com.fasterxml.jackson.core.filter.TokenFilter.includeElement.

Method 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:

  • null to indicate that the Array element should be skipped
  • INCLUDE_ALL to indicate that the Array element should be included completely in output
  • Any other 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.

Parameters
index:int

Array element index (0-based) to check

Returns:TokenFilter

TokenFilter to use for further calls within element value, unless return value is null or INCLUDE_ALL (which have simpler semantics)

Annotations
@Override
includePropertyback to summary
public TokenFilter includeProperty(String name)

Overrides com.fasterxml.jackson.core.filter.TokenFilter.includeProperty.

Doc from com.fasterxml.jackson.core.filter.TokenFilter.includeProperty.

Method 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:

  • null to indicate that the property and its value should be skipped
  • INCLUDE_ALL to indicate that the property and its value should be included completely in output
  • Any other 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.

Parameters
name:String

Name of Object property to check

Returns:TokenFilter

TokenFilter to use for further calls within property value, unless return value is null or INCLUDE_ALL (which have simpler semantics)

Annotations
@Override
toStringback to summary
public String toString()

Overrides com.fasterxml.jackson.core.filter.TokenFilter.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override