Class CBORWriteContext
java.lang.Object
tools.jackson.core.TokenStreamContext
tools.jackson.dataformat.cbor.CBORWriteContext
public final class CBORWriteContext
extends tools.jackson.core.TokenStreamContext
Replacement for
JsonWriteContext, needed to support alternative
numeric field id for Integer-valued Maps that CBOR allows.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CBORWriteContextprotected StringName of the Object property of which value is to be written; only used for OBJECT contextsprotected longAlternative to_currentNameused for integer/long-valued Maps.protected Objectprotected tools.jackson.core.json.DupDetectorprotected booleanMarker used to indicate that we just wrote a property name (or Map name / id) and now expect a value to writeprotected final CBORWriteContextParent context for this context; null for root context.Fields inherited from class tools.jackson.core.TokenStreamContext
_index, _nestingDepth, _type, TYPE_ARRAY, TYPE_OBJECT, TYPE_ROOT -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCBORWriteContext(int type, CBORWriteContext parent, tools.jackson.core.json.DupDetector dups, Object currentValue) -
Method Summary
Modifier and TypeMethodDescriptionprivate final voidvoidMethod that can be used to both clear the accumulated references (specifically value set withassignCurrentValue(Object)) that should not be retained, and returns parent (as wouldgetParent()do).createChildArrayContext(Object currentValue) createChildObjectContext(Object currentValue) static CBORWriteContextcreateRootContext(tools.jackson.core.json.DupDetector dd) final Stringtools.jackson.core.json.DupDetectorfinal CBORWriteContextbooleanprivate CBORWriteContextwithDupDetector(tools.jackson.core.json.DupDetector dups) booleanMethod that writer is to call before it writes an Object property name.booleanwritePropertyId(long propertyId) booleanMethods inherited from class tools.jackson.core.TokenStreamContext
getCurrentIndex, getEntryCount, getNestingDepth, hasCurrentIndex, hasPathSegment, inArray, inObject, inRoot, pathAsPointer, pathAsPointer, startLocation, toString, typeDesc
-
Field Details
-
_parent
Parent context for this context; null for root context. -
_dups
protected tools.jackson.core.json.DupDetector _dups -
_childToRecycle
-
_currentName
Name of the Object property of which value is to be written; only used for OBJECT contexts -
_currentValue
-
_currentPropertyId
protected long _currentPropertyIdAlternative to_currentNameused for integer/long-valued Maps. -
_gotPropertyId
protected boolean _gotPropertyIdMarker used to indicate that we just wrote a property name (or Map name / id) and now expect a value to write
-
-
Constructor Details
-
CBORWriteContext
protected CBORWriteContext(int type, CBORWriteContext parent, tools.jackson.core.json.DupDetector dups, Object currentValue)
-
-
Method Details
-
reset
-
withDupDetector
-
currentValue
- Overrides:
currentValuein classtools.jackson.core.TokenStreamContext
-
assignCurrentValue
- Overrides:
assignCurrentValuein classtools.jackson.core.TokenStreamContext
-
createRootContext
-
createChildArrayContext
-
createChildObjectContext
-
getParent
- Specified by:
getParentin classtools.jackson.core.TokenStreamContext
-
currentName
- Specified by:
currentNamein classtools.jackson.core.TokenStreamContext
-
hasCurrentName
public boolean hasCurrentName()- Overrides:
hasCurrentNamein classtools.jackson.core.TokenStreamContext
-
clearAndGetParent
Method that can be used to both clear the accumulated references (specifically value set withassignCurrentValue(Object)) that should not be retained, and returns parent (as wouldgetParent()do). Typically called when closing the active context when encounteringJsonToken.END_ARRAYorJsonToken.END_OBJECT. -
getDupDetector
public tools.jackson.core.json.DupDetector getDupDetector() -
writeName
Method that writer is to call before it writes an Object property name.- Returns:
- Ok if name writing should proceed
- Throws:
tools.jackson.core.exc.StreamWriteException
-
writePropertyId
public boolean writePropertyId(long propertyId) throws tools.jackson.core.exc.StreamWriteException - Throws:
tools.jackson.core.exc.StreamWriteException
-
_checkDup
private final void _checkDup(tools.jackson.core.json.DupDetector dd, String name) throws tools.jackson.core.exc.StreamWriteException - Throws:
tools.jackson.core.exc.StreamWriteException
-
writeValue
public boolean writeValue()
-