Class CBORWriteContext
java.lang.Object
com.fasterxml.jackson.core.JsonStreamContext
com.fasterxml.jackson.dataformat.cbor.CBORWriteContext
public final class CBORWriteContext
extends com.fasterxml.jackson.core.JsonStreamContext
Replacement for
JsonWriteContext
, needed to support alternative
numeric field id for Integer-valued Maps that CBOR allows.- Since:
- 2.10
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CBORWriteContext
protected long
Alternative to_currentName
used for integer/long-valued Maps.protected String
Name of the field of which value is to be written; only used for OBJECT contextsprotected Object
protected com.fasterxml.jackson.core.json.DupDetector
protected boolean
Marker used to indicate that we just wrote a field name (or Map name / id) and now expect a value to writeprotected final CBORWriteContext
Parent context for this context; null for root context.Fields inherited from class com.fasterxml.jackson.core.JsonStreamContext
_index, _nestingDepth, _type, TYPE_ARRAY, TYPE_OBJECT, TYPE_ROOT
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CBORWriteContext
(int type, CBORWriteContext parent, com.fasterxml.jackson.core.json.DupDetector dups, Object currentValue) -
Method Summary
Modifier and TypeMethodDescriptionprivate final void
Method that can be used to both clear the accumulated references (specifically value set withsetCurrentValue(Object)
) that should not be retained, and returns parent (as wouldgetParent()
do).createChildArrayContext
(Object currentValue) createChildObjectContext
(Object currentValue) static CBORWriteContext
createRootContext
(com.fasterxml.jackson.core.json.DupDetector dd) final String
com.fasterxml.jackson.core.json.DupDetector
final CBORWriteContext
boolean
private CBORWriteContext
void
withDupDetector
(com.fasterxml.jackson.core.json.DupDetector dups) boolean
writeFieldId
(long fieldId) boolean
writeFieldName
(String name) Method that writer is to call before it writes a field name.boolean
Methods inherited from class com.fasterxml.jackson.core.JsonStreamContext
getCurrentIndex, getEntryCount, getNestingDepth, getStartLocation, getTypeDesc, hasCurrentIndex, hasPathSegment, inArray, inObject, inRoot, pathAsPointer, pathAsPointer, startLocation, toString, typeDesc
-
Field Details
-
_parent
Parent context for this context; null for root context. -
_dups
protected com.fasterxml.jackson.core.json.DupDetector _dups -
_childToRecycle
-
_currentName
Name of the field of which value is to be written; only used for OBJECT contexts -
_currentValue
-
_currentFieldId
protected long _currentFieldIdAlternative to_currentName
used for integer/long-valued Maps. -
_gotFieldId
protected boolean _gotFieldIdMarker used to indicate that we just wrote a field name (or Map name / id) and now expect a value to write
-
-
Constructor Details
-
CBORWriteContext
protected CBORWriteContext(int type, CBORWriteContext parent, com.fasterxml.jackson.core.json.DupDetector dups, Object currentValue)
-
-
Method Details
-
reset
-
withDupDetector
-
getCurrentValue
- Overrides:
getCurrentValue
in classcom.fasterxml.jackson.core.JsonStreamContext
-
setCurrentValue
- Overrides:
setCurrentValue
in classcom.fasterxml.jackson.core.JsonStreamContext
-
createRootContext
-
createChildArrayContext
-
createChildObjectContext
-
getParent
- Specified by:
getParent
in classcom.fasterxml.jackson.core.JsonStreamContext
-
getCurrentName
- Specified by:
getCurrentName
in classcom.fasterxml.jackson.core.JsonStreamContext
-
hasCurrentName
public boolean hasCurrentName()- Overrides:
hasCurrentName
in classcom.fasterxml.jackson.core.JsonStreamContext
-
clearAndGetParent
Method that can be used to both clear the accumulated references (specifically value set withsetCurrentValue(Object)
) that should not be retained, and returns parent (as wouldgetParent()
do). Typically called when closing the active context when encounteringJsonToken.END_ARRAY
orJsonToken.END_OBJECT
. -
getDupDetector
public com.fasterxml.jackson.core.json.DupDetector getDupDetector() -
writeFieldName
public boolean writeFieldName(String name) throws com.fasterxml.jackson.core.JsonProcessingException Method that writer is to call before it writes a field name.- Returns:
- Ok if name writing should proceed
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
writeFieldId
public boolean writeFieldId(long fieldId) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
_checkDup
private final void _checkDup(com.fasterxml.jackson.core.json.DupDetector dd, String name) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
writeValue
public boolean writeValue()
-