Class TokenFilterContext
java.lang.Object
com.fasterxml.jackson.core.JsonStreamContext
com.fasterxml.jackson.core.filter.TokenFilterContext
Alternative variant of
JsonStreamContext, used when filtering
content being read or written (based on TokenFilter).- Since:
- 2.6
-
Field Summary
Fields inherited from class com.fasterxml.jackson.core.JsonStreamContext
TYPE_ARRAY, TYPE_OBJECT, TYPE_ROOT -
Method Summary
Modifier and TypeMethodDescriptioncheckValue(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, boolean writeStart) createChildObjectContext(TokenFilter filter, boolean writeStart) static TokenFilterContextcreateRootContext(TokenFilter filter) voidMethod called to ensure that field name, if present, has been written; may result (but does not always) in a call using given generatorfindChildOf(TokenFilterContext parent) 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.final TokenFilterContextAccessor for finding parent context of this context; will return null for root context.booleanbooleanvoidMethod to call to pass value to be returned viaJsonStreamContext.getCurrentValue(); typically called indirectly throughJsonParser.setCurrentValue(java.lang.Object)orJsonGenerator.setCurrentValue(java.lang.Object)).setFieldName(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 com.fasterxml.jackson.core.JsonStreamContext
getCurrentIndex, getEntryCount, getNestingDepth, getStartLocation, getTypeDesc, hasCurrentIndex, hasPathSegment, inArray, inObject, inRoot, pathAsPointer, pathAsPointer, startLocation, typeDesc
-
Method Details
-
createRootContext
-
createChildArrayContext
-
createChildObjectContext
-
setFieldName
- Throws:
JsonProcessingException
-
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
-
ensureFieldNameWritten
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- Generator to use to write the property name, if necessary- Throws:
IOException- 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:
IOException- If there is a problem writing property name (typically thrown byJsonGenerator)
-
closeArray
- Throws:
IOException
-
closeObject
- Throws:
IOException
-
skipParentChecks
public void skipParentChecks() -
getCurrentValue
Description copied from class:JsonStreamContextMethod 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:
getCurrentValuein classJsonStreamContext- Returns:
- Currently active value, if one has been assigned.
-
setCurrentValue
Description copied from class:JsonStreamContextMethod to call to pass value to be returned viaJsonStreamContext.getCurrentValue(); typically called indirectly throughJsonParser.setCurrentValue(java.lang.Object)orJsonGenerator.setCurrentValue(java.lang.Object)).- Overrides:
setCurrentValuein classJsonStreamContext- Parameters:
v- Current value to assign to this context
-
getParent
Description copied from class:JsonStreamContextAccessor for finding parent context of this context; will return null for root context.- Specified by:
getParentin classJsonStreamContext- Returns:
- Parent context of this context, if any;
nullfor Root contexts
-
getCurrentName
Description copied from class:JsonStreamContextMethod for accessing name associated with the current location. Non-null forFIELD_NAMEand value events that directly follow field names; null for root level and array values.- Specified by:
getCurrentNamein classJsonStreamContext- Returns:
- Current field name within context, if any;
nullif none
-
hasCurrentName
public boolean hasCurrentName()- Overrides:
hasCurrentNamein classJsonStreamContext- Returns:
Trueif a call toJsonStreamContext.getCurrentName()would return non-nullname;falseotherwise
-
getFilter
-
isStartHandled
public boolean isStartHandled() -
nextTokenToRead
-
findChildOf
-
toString
Description copied from class:JsonStreamContextOverridden to provide developer readable "JsonPath" representation of the context.- Overrides:
toStringin classJsonStreamContext- Returns:
- Simple developer-readable description this context layer
(note: NOT constructed with parents, unlike
JsonStreamContext.pathAsPointer())
-