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

public Class TokenFilterContext

extends JsonStreamContext
Class Inheritance
Imports
java.io.IOException, com.fasterxml.jackson.core.*

Alternative variant of JsonStreamContext, used when filtering content being read or written (based on TokenFilter).
Since
2.6

Field Summary

Modifier and TypeField and Description
protected TokenFilterContext
protected String
_currentName

Name of the field of which value is to be parsed; only used for OBJECT contexts

protected TokenFilter
_filter

Filter to use for items in this state (for properties of Objects, elements of Arrays, and root-level values of root context)

protected boolean
_needToHandleName

Flag that indicates that the current name of this context still needs to be read/written, if path from root down to included leaf is to be exposed.

protected final TokenFilterContext
_parent

Parent context for this context; null for root context.

protected boolean
_startHandled

Flag that indicates that start token has been read/written, so that matching close token needs to be read/written as well when context is getting closed.

Inherited from com.fasterxml.jackson.core.JsonStreamContext:
_index_nestingDepth_typeTYPE_ARRAYTYPE_OBJECTTYPE_ROOT

Constructor Summary

AccessConstructor and Description
protected
TokenFilterContext(int type, TokenFilterContext parent, TokenFilter filter, boolean startHandled)

Method Summary

Modifier and TypeMethod and Description
private void
protected void
public TokenFilter

Returns:

Filter to use for value
checkValue
(TokenFilter
Currently active filter
filter
)

Method called to check whether value is to be included at current output position, either as Object property, Array element, or root value.

public TokenFilterContext
public TokenFilterContext
public TokenFilterContext
createChildArrayContext(TokenFilter filter, boolean writeStart)

public TokenFilterContext
createChildObjectContext(TokenFilter filter, boolean writeStart)

public static TokenFilterContext
public void
ensureFieldNameWritten(JsonGenerator
Generator to use to write the property name, if necessary
gen
)

Method called to ensure that field name, if present, has been written; may result (but does not always) in a call using given generator

public TokenFilterContext
public final String
getCurrentName()

Implements abstract com.fasterxml.jackson.core.JsonStreamContext.getCurrentName.

Method for accessing name associated with the current location.

public Object
getCurrentValue()

Overrides com.fasterxml.jackson.core.JsonStreamContext.getCurrentValue.

Method for accessing currently active value being used by data-binding (as the source of streaming data to write, or destination of data being read), at this level in hierarchy.

public TokenFilter
public final TokenFilterContext
getParent()

Implements abstract com.fasterxml.jackson.core.JsonStreamContext.getParent.

Accessor for finding parent context of this context; will return null for root context.

public boolean
public boolean
public JsonToken
protected TokenFilterContext
reset(int type, TokenFilter filter, boolean startWritten)

public void
setCurrentValue(Object
Current value to assign to this context
v
)

Overrides com.fasterxml.jackson.core.JsonStreamContext.setCurrentValue.

Method to call to pass value to be returned via getCurrentValue; typically called indirectly through JsonParser#setCurrentValue or JsonGenerator#setCurrentValue).

public TokenFilter
public void
public String
toString()

Overrides com.fasterxml.jackson.core.JsonStreamContext.toString.

Overridden to provide developer readable "JsonPath" representation of the context.

public void
writePath(JsonGenerator
Generator to use to write the path, if necessary
gen
)

Method called to ensure that parent path from root is written up to and including this node.

Inherited from com.fasterxml.jackson.core.JsonStreamContext:
getCurrentIndexgetEntryCountgetNestingDepthgetStartLocationgetTypeDeschasCurrentIndexhasPathSegmentinArrayinObjectinRootpathAsPointerpathAsPointerstartLocationtypeDesc

Field Detail

_childback to summary
protected TokenFilterContext _child
_currentNameback to summary
protected String _currentName

Name of the field of which value is to be parsed; only used for OBJECT contexts

_filterback to summary
protected TokenFilter _filter

Filter to use for items in this state (for properties of Objects, elements of Arrays, and root-level values of root context)

_needToHandleNameback to summary
protected boolean _needToHandleName

Flag that indicates that the current name of this context still needs to be read/written, if path from root down to included leaf is to be exposed.

_parentback to summary
protected final TokenFilterContext _parent

Parent context for this context; null for root context.

_startHandledback to summary
protected boolean _startHandled

Flag that indicates that start token has been read/written, so that matching close token needs to be read/written as well when context is getting closed.

Constructor Detail

TokenFilterContextback to summary
protected TokenFilterContext(int type, TokenFilterContext parent, TokenFilter filter, boolean startHandled)

Method Detail

_writePathback to summary
private void _writePath(JsonGenerator gen) throws IOException
appendDescback to summary
protected void appendDesc(StringBuilder sb)
checkValueback to summary
public TokenFilter checkValue(TokenFilter filter)

Method called to check whether value is to be included at current output position, either as Object property, Array element, or root value.

Parameters
filter:TokenFilter

Currently active filter

Returns:TokenFilter

Filter to use for value

closeArrayback to summary
public TokenFilterContext closeArray(JsonGenerator gen) throws IOException
closeObjectback to summary
public TokenFilterContext closeObject(JsonGenerator gen) throws IOException
createChildArrayContextback to summary
public TokenFilterContext createChildArrayContext(TokenFilter filter, boolean writeStart)
createChildObjectContextback to summary
public TokenFilterContext createChildObjectContext(TokenFilter filter, boolean writeStart)
createRootContextback to summary
public static TokenFilterContext createRootContext(TokenFilter filter)
ensureFieldNameWrittenback to summary
public void ensureFieldNameWritten(JsonGenerator gen) throws IOException

Method called to ensure that field name, if present, has been written; may result (but does not always) in a call using given generator

Parameters
gen:JsonGenerator

Generator to use to write the property name, if necessary

Exceptions
IOException:
If there is a problem writing property name (typically thrown by JsonGenerator)
findChildOfback to summary
public TokenFilterContext findChildOf(TokenFilterContext parent)
getCurrentNameback to summary
public final String getCurrentName()

Implements abstract com.fasterxml.jackson.core.JsonStreamContext.getCurrentName.

Doc from com.fasterxml.jackson.core.JsonStreamContext.getCurrentName.

Method for accessing name associated with the current location. Non-null for FIELD_NAME and value events that directly follow field names; null for root level and array values.

Returns:String

Current field name within context, if any; null if none

Annotations
@Override
getCurrentValueback to summary
public Object getCurrentValue()

Overrides com.fasterxml.jackson.core.JsonStreamContext.getCurrentValue.

Doc from com.fasterxml.jackson.core.JsonStreamContext.getCurrentValue.

Method for accessing currently active value being used by data-binding (as the source of streaming data to write, or destination of data being read), at this level in hierarchy.

Note that "current value" is NOT populated (or used) by Streaming parser or generator; it is only used by higher-level data-binding functionality. The reason it is included here is that it can be stored and accessed hierarchically, and gets passed through data-binding.

Returns:Object

Currently active value, if one has been assigned.

Annotations
@Override
getFilterback to summary
public TokenFilter getFilter()
getParentback to summary
public final TokenFilterContext getParent()

Implements abstract com.fasterxml.jackson.core.JsonStreamContext.getParent.

Doc from com.fasterxml.jackson.core.JsonStreamContext.getParent.

Accessor for finding parent context of this context; will return null for root context.

Returns:TokenFilterContext

Parent context of this context, if any; null for Root contexts

Annotations
@Override
hasCurrentNameback to summary
public boolean hasCurrentName()

Overrides com.fasterxml.jackson.core.JsonStreamContext.hasCurrentName.

Returns:boolean

Doc from com.fasterxml.jackson.core.JsonStreamContext.hasCurrentName.

True if a call to getCurrentName() would return non-null name; false otherwise

Annotations
@Override
isStartHandledback to summary
public boolean isStartHandled()
nextTokenToReadback to summary
public JsonToken nextTokenToRead()
resetback to summary
protected TokenFilterContext reset(int type, TokenFilter filter, boolean startWritten)
setCurrentValueback to summary
public void setCurrentValue(Object v)

Overrides com.fasterxml.jackson.core.JsonStreamContext.setCurrentValue.

Doc from com.fasterxml.jackson.core.JsonStreamContext.setCurrentValue.

Method to call to pass value to be returned via getCurrentValue; typically called indirectly through JsonParser#setCurrentValue or JsonGenerator#setCurrentValue).

Parameters
v:Object

Current value to assign to this context

Annotations
@Override
setFieldNameback to summary
public TokenFilter setFieldName(String name) throws JsonProcessingException
skipParentChecksback to summary
public void skipParentChecks()
toStringback to summary
public String toString()

Overrides com.fasterxml.jackson.core.JsonStreamContext.toString.

Doc from com.fasterxml.jackson.core.JsonStreamContext.toString.

Overridden to provide developer readable "JsonPath" representation of the context.

Returns:String

Simple developer-readable description this context layer (note: NOT constructed with parents, unlike pathAsPointer)

Annotations
@Override
writePathback to summary
public void writePath(JsonGenerator gen) throws IOException

Method called to ensure that parent path from root is written up to and including this node.

Parameters
gen:JsonGenerator

Generator to use to write the path, if necessary

Exceptions
IOException:
If there is a problem writing property name (typically thrown by JsonGenerator)