Package com.fasterxml.jackson.core.filter

# Class JsonPointerBasedFilter

java.lang.Object
com.fasterxml.jackson.core.filter.TokenFilter
com.fasterxml.jackson.core.filter.JsonPointerBasedFilter

public class JsonPointerBasedFilter extends TokenFilter
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 com.fasterxml.jackson.core.filter.TokenFilter

`TokenFilter.Inclusion`

## Field Summary

Fields
Modifier and Type
Field
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`
`_pathToMatch`

### Fields inherited from class com.fasterxml.jackson.core.filter.TokenFilter

`INCLUDE_ALL`

## Constructor Summary

Constructors
Constructor
Description
`JsonPointerBasedFilter(JsonPointer pathToMatch)`
`JsonPointerBasedFilter(JsonPointer pathToMatch, boolean includeAllElements)`
`JsonPointerBasedFilter(String ptrExpr)`

## Method Summary

Modifier and Type
Method
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()`

### Methods inherited from class com.fasterxml.jackson.core.filter.TokenFilter

`filterFinishArray, filterFinishObject, includeBinary, includeBoolean, includeEmbeddedValue, includeEmptyArray, includeEmptyObject, includeNull, includeNumber, includeNumber, includeNumber, includeNumber, includeNumber, includeNumber, includeRawValue, includeRootValue, includeString, includeString, includeValue`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### _pathToMatch

protected final JsonPointer _pathToMatch

### _includeAllElements

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

## Constructor Details

### JsonPointerBasedFilter

public JsonPointerBasedFilter(String ptrExpr)

### JsonPointerBasedFilter

public JsonPointerBasedFilter(JsonPointer pathToMatch)

Parameters:
  `pathToMatch` - Content to extract

### JsonPointerBasedFilter

public JsonPointerBasedFilter(JsonPointer pathToMatch, boolean includeAllElements)

Parameters:
  `pathToMatch` - Content to extract
  `includeAllElements` - if true array indexes in `ptrExpr` are ignored and all elements will be matched. default: false
Since:
  2.16

## Method Details

### construct

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.

Parameters:
  `pathToMatch` - Remaining path for filter to match
  `includeAllElements` - Whether to just include all array elements of matching Array-valued path automatically
Since:
  2.16

### includeElement

public TokenFilter includeElement(int index)
Description copied from class: `TokenFilter`
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
- `TokenFilter.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.

Overrides:
  `includeElement` in class `TokenFilter`
Parameters:
  `index` - Array element index (0-based) to check
Returns:
  TokenFilter to use for further calls within element value, unless return value is `null` or `TokenFilter.INCLUDE_ALL` (which have simpler semantics)

### includeProperty

public TokenFilter includeProperty(String name)
Description copied from class: `TokenFilter`
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
- `TokenFilter.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.

Overrides:
  `includeProperty` in class `TokenFilter`
Parameters:
  `name` - Name of Object property to check
Returns:
  TokenFilter to use for further calls within property value, unless return value is `null` or `TokenFilter.INCLUDE_ALL` (which have simpler semantics)

### filterStartArray

public TokenFilter filterStartArray()
Description copied from class: `TokenFilter`
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
- `TokenFilter.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. `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:
  `filterStartArray` in class `TokenFilter`
Returns:
  TokenFilter to use for further calls within Array, unless return value is `null` or `TokenFilter.INCLUDE_ALL` (which have simpler semantics)

### filterStartObject

public TokenFilter filterStartObject()
Description copied from class: `TokenFilter`
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
- `TokenFilter.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. `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:
  `filterStartObject` in class `TokenFilter`
Returns:
  TokenFilter to use for further calls within Array, unless return value is `null` or `TokenFilter.INCLUDE_ALL` (which have simpler semantics)

### _includeScalar

protected boolean _includeScalar()
Description copied from class: `TokenFilter`
Overridable default implementation delegated to all scalar value inclusion check methods. The default implementation simply includes all leaf values.

Overrides:
  `_includeScalar` in class `TokenFilter`
Returns:
  Whether all leaf scalar values should be included (`true`) or not (`false`)

### toString

public String toString()

Overrides:
  `toString` in class `TokenFilter`