java.lang.Object
tools.jackson.core.TokenStreamContext
tools.jackson.core.filter.TokenFilterContext
Alternative variant of
TokenStreamContext, used when filtering
content being read or written (based on TokenFilter).-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TokenFilterContextprotected StringName of the property of which value is to be parsed; only used for OBJECT contextsprotected Objectprotected TokenFilterFilter to use for items in this state (for properties of Objects, elements of Arrays, and root-level values of root context)protected booleanFlag 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 TokenFilterContextParent context for this context; null for root context.protected booleanFlag 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.Fields inherited from class tools.jackson.core.TokenStreamContext
_index, _nestingDepth, _type, TYPE_ARRAY, TYPE_OBJECT, TYPE_ROOT -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTokenFilterContext(int type, TokenFilterContext parent, TokenFilter filter, Object currValue, boolean startHandled) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidMethod to call to pass value to be returned viaTokenStreamContext.currentValue(); typically called indirectly throughJsonParser.assignCurrentValue(java.lang.Object)orJsonGenerator.assignCurrentValue(java.lang.Object)).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.closeArray(JsonGenerator gen) closeObject(JsonGenerator gen) createChildArrayContext(TokenFilter filter, Object currentValue, boolean writeStart) createChildObjectContext(TokenFilter filter, Object currentValue, boolean writeStart) static TokenFilterContextcreateRootContext(TokenFilter filter) final StringMethod for accessing name associated with the current location.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.voidMethod called to ensure that the property name, if present, has been written; may result (but does not always) in a call using given generatorfindChildOf(TokenFilterContext parent) final TokenFilterContextAccessor for finding parent context of this context; will return null for root context.booleanbooleanprotected TokenFilterContextreset(int type, TokenFilter filter, Object currValue, boolean startWritten) setPropertyName(String name) voidtoString()Overridden to provide developer readable "JsonPath" representation of the context.voidwritePath(JsonGenerator gen) Method called to ensure that parent path from root is written up to and including this node.Methods inherited from class tools.jackson.core.TokenStreamContext
getCurrentIndex, getEntryCount, getNestingDepth, hasCurrentIndex, hasPathSegment, inArray, inObject, inRoot, pathAsPointer, pathAsPointer, startLocation, typeDesc
-
Field Details
-
_parent
Parent context for this context; null for root context. -
_child
-
_currentName
Name of the property of which value is to be parsed; only used for OBJECT contexts -
_currentValue
- Since:
- 3.0
-
_filter
Filter to use for items in this state (for properties of Objects, elements of Arrays, and root-level values of root context) -
_startHandled
protected boolean _startHandledFlag 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. -
_needToHandleName
protected boolean _needToHandleNameFlag 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.
-
-
Constructor Details
-
TokenFilterContext
protected TokenFilterContext(int type, TokenFilterContext parent, TokenFilter filter, Object currValue, boolean startHandled)
-
-
Method Details
-
reset
protected TokenFilterContext reset(int type, TokenFilter filter, Object currValue, boolean startWritten) -
createRootContext
-
createChildArrayContext
public TokenFilterContext createChildArrayContext(TokenFilter filter, Object currentValue, boolean writeStart) -
createChildObjectContext
public TokenFilterContext createChildObjectContext(TokenFilter filter, Object currentValue, boolean writeStart) -
setPropertyName
-
checkValue
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- Currently active filter- Returns:
- Filter to use for value
-
ensurePropertyNameWritten
Method called to ensure that the property name, if present, has been written; may result (but does not always) in a call using given generator- Parameters:
gen- Generator to use to write the property name, if necessary- Throws:
JacksonException- If there is a problem writing property name (typically thrown byJsonGenerator)
-
writePath
Method called to ensure that parent path from root is written up to and including this node.- Parameters:
gen- Generator to use to write the path, if necessary- Throws:
JacksonException- If there is a problem writing property name (typically thrown byJsonGenerator)
-
closeArray
- Throws:
JacksonException
-
closeObject
- Throws:
JacksonException
-
skipParentChecks
public void skipParentChecks() -
currentValue
Description copied from class:TokenStreamContextMethod 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.
- Overrides:
currentValuein classTokenStreamContext- Returns:
- Currently active value, if one has been assigned.
-
assignCurrentValue
Description copied from class:TokenStreamContextMethod to call to pass value to be returned viaTokenStreamContext.currentValue(); typically called indirectly throughJsonParser.assignCurrentValue(java.lang.Object)orJsonGenerator.assignCurrentValue(java.lang.Object)).- Overrides:
assignCurrentValuein classTokenStreamContext- Parameters:
v- Current value to assign to this context
-
getParent
Description copied from class:TokenStreamContextAccessor for finding parent context of this context; will return null for root context.- Specified by:
getParentin classTokenStreamContext- Returns:
- Parent context of this context, if any;
nullfor Root contexts
-
currentName
Description copied from class:TokenStreamContextMethod for accessing name associated with the current location. Non-null forPROPERTY_NAMEand value events that directly follow Property names; null for root level and array values.- Specified by:
currentNamein classTokenStreamContext- Returns:
- Current property name within context, if any;
nullif none
-
hasCurrentName
public boolean hasCurrentName()- Overrides:
hasCurrentNamein classTokenStreamContext
-
getFilter
-
isStartHandled
public boolean isStartHandled() -
nextTokenToRead
-
findChildOf
-
appendDesc
-
toString
Description copied from class:TokenStreamContextOverridden to provide developer readable "JsonPath" representation of the context.- Overrides:
toStringin classTokenStreamContext- Returns:
- Simple developer-readable description this context layer
(note: NOT constructed with parents, unlike
TokenStreamContext.pathAsPointer())
-