Class TokenFilter
- java.lang.Object
-
- com.fasterxml.jackson.core.filter.TokenFilter
-
- Direct Known Subclasses:
JsonPointerBasedFilter
public class TokenFilter extends java.lang.ObjectStrategy class that can be implemented to specify actual inclusion/exclusion criteria for filtering, used byFilteringGeneratorDelegate.- Since:
- 2.6
-
-
Field Summary
Fields Modifier and Type Field Description static TokenFilterINCLUDE_ALLMarker value that should be used to indicate inclusion of a structured value (sub-tree representing Object or Array), or value of a named property (regardless of type).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfilterFinishArray()Method called to indicate that output of non-filtered Array (one that may have been included either completely, or in part) is completed, in cases where filter other thatINCLUDE_ALLwas returned.voidfilterFinishObject()Method called to indicate that output of non-filtered Object (one that may have been included either completely, or in part) is completed, in cases where filter other thatINCLUDE_ALLwas returned.TokenFilterfilterStartArray()Method called to check whether Array value at current output location should be included in output.TokenFilterfilterStartObject()Method called to check whether Object value at current output location should be included in output.booleanincludeBinary()Call made to verify whether leaf-level Binary value should be included in output or not.booleanincludeBoolean(boolean value)Call made to verify whether leaf-level boolean value should be included in output or not.TokenFilterincludeElement(int index)Method called to check whether array element with specified index (zero-based), at current output location, should be included in output.booleanincludeEmbeddedValue(java.lang.Object ob)Call made to verify whether leaf-level embedded (Opaque) value should be included in output or not.booleanincludeNull()Call made to verify whether leaf-level null value should be included in output or not.booleanincludeNumber(double v)Call made to verify whether leaf-leveldoublevalue should be included in output or not.booleanincludeNumber(float v)Call made to verify whether leaf-levelfloatvalue should be included in output or not.booleanincludeNumber(int v)Call made to verify whether leaf-levelintvalue should be included in output or not.booleanincludeNumber(long v)Call made to verify whether leaf-levellongvalue should be included in output or not.booleanincludeNumber(java.math.BigDecimal v)Call made to verify whether leaf-levelBigDecimalvalue should be included in output or not.booleanincludeNumber(java.math.BigInteger v)Call made to verify whether leaf-levelBigIntegervalue should be included in output or not.TokenFilterincludeProperty(java.lang.String name)Method called to check whether property value with specified name, at current output location, should be included in output.booleanincludeRawValue()Call made to verify whether leaf-level raw (pre-encoded, not quoted by generator) value should be included in output or not.TokenFilterincludeRootValue(int index)Method called to check whether root-level value, at current output location, should be included in output.booleanincludeString(java.lang.String value)Call made to verify whether leaf-level String value should be included in output or not.booleanincludeValue(JsonParser p)Call made when verifying whether a scaler value is being read from a parser.java.lang.StringtoString()
-
-
-
Field Detail
-
INCLUDE_ALL
public static final TokenFilter INCLUDE_ALL
Marker value that should be used to indicate inclusion of a structured value (sub-tree representing Object or Array), or value of a named property (regardless of type). Note that if this instance is returned, it will used as a marker, and no actual callbacks need to be made. For this reason, it is more efficient to return this instance if the whole sub-tree is to be included, instead of implementing similar filter functionality explicitly.
-
-
Method Detail
-
filterStartObject
public 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:nullto indicate that the Object should be skippedINCLUDE_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.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 to use for further calls within Array, unless return value
is
nullorINCLUDE_ALL(which have simpler semantics)
-
filterStartArray
public 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:nullto indicate that the Array should be skippedINCLUDE_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.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 to use for further calls within Array, unless return value
is
nullorINCLUDE_ALL(which have simpler semantics)
-
filterFinishObject
public void filterFinishObject()
Method called to indicate that output of non-filtered Object (one that may have been included either completely, or in part) is completed, in cases where filter other thatINCLUDE_ALLwas returned. This occurs whenJsonGenerator.writeEndObject()is called.
-
filterFinishArray
public void filterFinishArray()
Method called to indicate that output of non-filtered Array (one that may have been included either completely, or in part) is completed, in cases where filter other thatINCLUDE_ALLwas returned. This occurs whenJsonGenerator.writeEndArray()is called.
-
includeProperty
public TokenFilter includeProperty(java.lang.String name)
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:nullto indicate that the property and its value should be skippedINCLUDE_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.- Returns:
- TokenFilter to use for further calls within property value, unless return value
is
nullorINCLUDE_ALL(which have simpler semantics)
-
includeElement
public 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. Three kinds of return values may be used as follows:nullto indicate that the Array element should be skippedINCLUDE_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.- Returns:
- TokenFilter to use for further calls within element value, unless return value
is
nullorINCLUDE_ALL(which have simpler semantics)
-
includeRootValue
public TokenFilter includeRootValue(int index)
Method called to check whether root-level value, at current output location, should be included in output. Three kinds of return values may be used as follows:nullto indicate that the root value should be skippedINCLUDE_ALLto indicate that the root 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.- Returns:
- TokenFilter to use for further calls within root value, unless return value
is
nullorINCLUDE_ALL(which have simpler semantics)
-
includeValue
public boolean includeValue(JsonParser p) throws java.io.IOException
Call made when verifying whether a scaler value is being read from a parser.Default action is to call
_includeScalar()and return whatever it indicates.- Throws:
java.io.IOException
-
includeBoolean
public boolean includeBoolean(boolean value)
Call made to verify whether leaf-level boolean value should be included in output or not.
-
includeNull
public boolean includeNull()
Call made to verify whether leaf-level null value should be included in output or not.
-
includeString
public boolean includeString(java.lang.String value)
Call made to verify whether leaf-level String value should be included in output or not.
-
includeNumber
public boolean includeNumber(int v)
Call made to verify whether leaf-levelintvalue should be included in output or not. NOTE: also called for `short`, `byte`
-
includeNumber
public boolean includeNumber(long v)
Call made to verify whether leaf-levellongvalue should be included in output or not.
-
includeNumber
public boolean includeNumber(float v)
Call made to verify whether leaf-levelfloatvalue should be included in output or not.
-
includeNumber
public boolean includeNumber(double v)
Call made to verify whether leaf-leveldoublevalue should be included in output or not.
-
includeNumber
public boolean includeNumber(java.math.BigDecimal v)
Call made to verify whether leaf-levelBigDecimalvalue should be included in output or not.
-
includeNumber
public boolean includeNumber(java.math.BigInteger v)
Call made to verify whether leaf-levelBigIntegervalue should be included in output or not.
-
includeBinary
public boolean includeBinary()
Call made to verify whether leaf-level Binary value should be included in output or not.NOTE: no binary payload passed; assumption is this won't be of much use.
-
includeRawValue
public boolean includeRawValue()
Call made to verify whether leaf-level raw (pre-encoded, not quoted by generator) value should be included in output or not.NOTE: value itself not passed since it may come on multiple forms and is unlikely to be of much use in determining inclusion criteria.
-
includeEmbeddedValue
public boolean includeEmbeddedValue(java.lang.Object ob)
Call made to verify whether leaf-level embedded (Opaque) value should be included in output or not.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-