Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.cbor

public final Class CBORWriteContext

extends JsonStreamContext
Class Inheritance
Imports
com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.json.DupDetector

Replacement for JsonWriteContext, needed to support alternative numeric field id for Integer-valued Maps that CBOR allows.
Since
2.10

Field Summary

Modifier and TypeField and Description
protected CBORWriteContext
protected long
_currentFieldId

Alternative to _currentName used for integer/long-valued Maps.

protected String
_currentName

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

protected Object
protected DupDetector
protected boolean
_gotFieldId

Marker used to indicate that we just wrote a field name (or Map name / id) and now expect a value to write

protected final CBORWriteContext
_parent

Parent context for this context; null for root context.

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

Constructor Summary

AccessConstructor and Description
protected
CBORWriteContext(int type, CBORWriteContext parent, DupDetector dups, Object currentValue)

Method Summary

Modifier and TypeMethod and Description
private final void
public CBORWriteContext
clearAndGetParent()

Method that can be used to both clear the accumulated references (specifically value set with setCurrentValue(Object)) that should not be retained, and returns parent (as would getParent() do).

public CBORWriteContext
public CBORWriteContext
public static CBORWriteContext
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 DupDetector
public final CBORWriteContext
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
private CBORWriteContext
reset(int type, Object currentValue)

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 CBORWriteContext
public boolean
writeFieldId(long fieldId)

public boolean

Returns:

Ok if name writing should proceed
writeFieldName
(String name)

Method that writer is to call before it writes a field name.

public boolean
Inherited from com.fasterxml.jackson.core.JsonStreamContext:
getCurrentIndexgetEntryCountgetNestingDepthgetStartLocationgetTypeDeschasCurrentIndexhasPathSegmentinArrayinObjectinRootpathAsPointerpathAsPointerstartLocationtoStringtypeDesc

Field Detail

_childToRecycleback to summary
protected CBORWriteContext _childToRecycle
_currentFieldIdback to summary
protected long _currentFieldId

Alternative to _currentName used for integer/long-valued Maps.

_currentNameback to summary
protected String _currentName

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

_currentValueback to summary
protected Object _currentValue
_dupsback to summary
protected DupDetector _dups
_gotFieldIdback to summary
protected boolean _gotFieldId

Marker used to indicate that we just wrote a field name (or Map name / id) and now expect a value to write

_parentback to summary
protected final CBORWriteContext _parent

Parent context for this context; null for root context.

Constructor Detail

CBORWriteContextback to summary
protected CBORWriteContext(int type, CBORWriteContext parent, DupDetector dups, Object currentValue)

Method Detail

_checkDupback to summary
private final void _checkDup(DupDetector dd, String name) throws JsonProcessingException
clearAndGetParentback to summary
public CBORWriteContext clearAndGetParent()

Method that can be used to both clear the accumulated references (specifically value set with setCurrentValue(Object)) that should not be retained, and returns parent (as would getParent() do). Typically called when closing the active context when encountering JsonToken#END_ARRAY or JsonToken#END_OBJECT.

createChildArrayContextback to summary
public CBORWriteContext createChildArrayContext(Object currentValue)
createChildObjectContextback to summary
public CBORWriteContext createChildObjectContext(Object currentValue)
createRootContextback to summary
public static CBORWriteContext createRootContext(DupDetector dd)
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
getDupDetectorback to summary
public DupDetector getDupDetector()
getParentback to summary
public final CBORWriteContext 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:CBORWriteContext

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
resetback to summary
private CBORWriteContext reset(int type, Object currentValue)
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
withDupDetectorback to summary
public CBORWriteContext withDupDetector(DupDetector dups)
writeFieldIdback to summary
public boolean writeFieldId(long fieldId) throws JsonProcessingException
writeFieldNameback to summary
public boolean writeFieldName(String name) throws JsonProcessingException

Method that writer is to call before it writes a field name.

Returns:boolean

Ok if name writing should proceed

writeValueback to summary
public boolean writeValue()