public class TokenFilter extends Object
FilteringGeneratorDelegate
.Modifier and Type | Class and Description |
---|---|
static class |
TokenFilter.Inclusion
Enumeration that controls how TokenFilter return values are interpreted.
|
Modifier and Type | Field and Description |
---|---|
static 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).
|
Modifier | Constructor and Description |
---|---|
protected |
TokenFilter() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
_includeScalar()
Overridable default implementation delegated to all scalar value
inclusion check methods.
|
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 that
INCLUDE_ALL was returned. |
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 that
INCLUDE_ALL was returned. |
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.
|
boolean |
includeBinary()
Call made to verify whether leaf-level
Binary value
should be included in output or not.
|
boolean |
includeBoolean(boolean value)
Call made to verify whether leaf-level
boolean value
should be included in output or not.
|
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.
|
boolean |
includeEmbeddedValue(Object value)
Call made to verify whether leaf-level
embedded (Opaque) value
should be included in output or not.
|
boolean |
includeNull()
Call made to verify whether leaf-level
null value
should be included in output or not.
|
boolean |
includeNumber(BigDecimal value)
Call made to verify whether leaf-level
BigDecimal value
should be included in output or not. |
boolean |
includeNumber(BigInteger value)
Call made to verify whether leaf-level
BigInteger value
should be included in output or not. |
boolean |
includeNumber(double value)
Call made to verify whether leaf-level
double value
should be included in output or not. |
boolean |
includeNumber(float value)
Call made to verify whether leaf-level
float value
should be included in output or not. |
boolean |
includeNumber(int value)
Call made to verify whether leaf-level
int value
should be included in output or not. |
boolean |
includeNumber(long value)
Call made to verify whether leaf-level
long value
should be included in output or not. |
TokenFilter |
includeProperty(String name)
Method called to check whether property value with specified name,
at current output location, should be included in output.
|
boolean |
includeRawValue()
Call made to verify whether leaf-level
raw (pre-encoded, not quoted by generator) value
should be included in output or not.
|
TokenFilter |
includeRootValue(int index)
Method called to check whether root-level value,
at current output location, should be included in output.
|
boolean |
includeString(Reader r,
int maxLen)
Call made to verify whether leaf-level
"streaming" String value
should be included in output or not.
|
boolean |
includeString(String value)
Call made to verify whether leaf-level
String value
should be included in output or not.
|
boolean |
includeValue(JsonParser p)
Call made when verifying whether a scalar value is being
read from a parser.
|
String |
toString() |
public static final TokenFilter INCLUDE_ALL
public TokenFilter filterStartObject()
null
to indicate that the Object should be skipped
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. 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.
null
or INCLUDE_ALL
(which have simpler semantics)public TokenFilter filterStartArray()
null
to indicate that the Array should be skipped
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. 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.
null
or INCLUDE_ALL
(which have simpler semantics)public void filterFinishObject()
INCLUDE_ALL
was returned.
This occurs when JsonGenerator.writeEndObject()
is called.public void filterFinishArray()
INCLUDE_ALL
was returned.
This occurs when JsonGenerator.writeEndArray()
is called.public TokenFilter includeProperty(String name)
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
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.
name
- Name of Object property to checknull
or INCLUDE_ALL
(which have simpler semantics)public TokenFilter includeElement(int index)
null
to indicate that the Array element should be skipped
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.
index
- Array element index (0-based) to checknull
or INCLUDE_ALL
(which have simpler semantics)public TokenFilter includeRootValue(int index)
null
to indicate that the root value should be skipped
INCLUDE_ALL
to indicate that the root 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.
index
- Index (0-based) of the root value to checknull
or INCLUDE_ALL
(which have simpler semantics)public boolean includeValue(JsonParser p) throws IOException
Default action is to call _includeScalar()
and return
whatever it indicates.
p
- Parser that points to the value (typically delegate
parser, not filtering parser that wraps it)IOException
- if there are any problems reading content (typically
via calling passed-in JsonParser
)public boolean includeBoolean(boolean value)
value
- Value to checkpublic boolean includeNull()
null
) value is to be included; false if notpublic boolean includeString(String value)
value
- Value to checkpublic boolean includeString(Reader r, int maxLen)
NOTE: note that any reads from passed in Reader
may lead
to actual loss of content to write; typically method should NOT
access content passed via this method.
r
- Reader used to pass String value to parsermaxLen
- indicated maximum length of String valuepublic boolean includeNumber(int value)
int
value
should be included in output or not.
NOTE: also called for `short`, `byte`value
- Value to checkpublic boolean includeNumber(long value)
long
value
should be included in output or not.value
- Value to checkpublic boolean includeNumber(float value)
float
value
should be included in output or not.value
- Value to checkpublic boolean includeNumber(double value)
double
value
should be included in output or not.value
- Value to checkpublic boolean includeNumber(BigDecimal value)
BigDecimal
value
should be included in output or not.value
- Value to checkpublic boolean includeNumber(BigInteger value)
BigInteger
value
should be included in output or not.value
- Value to checkpublic boolean includeBinary()
NOTE: no binary payload passed; assumption is this won't be of much use.
public boolean includeRawValue()
NOTE: value itself not passed since it may come on multiple forms and is unlikely to be of much use in determining inclusion criteria.
public boolean includeEmbeddedValue(Object value)
value
- Value to checkprotected boolean _includeScalar()
true
)
or not (false
)Copyright © 2008–2021 FasterXML. All rights reserved.