Top Description Fields Constructors Methods
tools.jackson.dataformat.cbor

public final Class CBORWriteContext

extends TokenStreamContext
Class Inheritance
Imports
tools.jackson.core.*, tools.jackson.core.exc.StreamWriteException, tools.jackson.core.json.DupDetector

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

Field Summary

Modifier and TypeField and Description
protected CBORWriteContext
protected String
_currentName

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

protected long
_currentPropertyId

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

protected Object
protected DupDetector
protected boolean
_gotPropertyId

Marker used to indicate that we just wrote a property 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 tools.jackson.core.TokenStreamContext:
_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 void
assignCurrentValue(Object v)

Overrides tools.jackson.core.TokenStreamContext.assignCurrentValue.

Method to call to pass value to be returned via currentValue; typically called indirectly through JsonParser#assignCurrentValue or JsonGenerator#assignCurrentValue).

public CBORWriteContext
clearAndGetParent()

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

public CBORWriteContext
public CBORWriteContext
public static CBORWriteContext
public final String
currentName()

Implements abstract tools.jackson.core.TokenStreamContext.currentName.

Method for accessing name associated with the current location.

public Object
currentValue()

Overrides tools.jackson.core.TokenStreamContext.currentValue.

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 tools.jackson.core.TokenStreamContext.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 CBORWriteContext
public boolean

Returns:

Ok if name writing should proceed
writeName
(String name)

Method that writer is to call before it writes an Object property name.

public boolean
writePropertyId(long propertyId)

public boolean
Inherited from tools.jackson.core.TokenStreamContext:
getCurrentIndexgetEntryCountgetNestingDepthhasCurrentIndexhasPathSegmentinArrayinObjectinRootpathAsPointerpathAsPointerstartLocationtoStringtypeDesc

Field Detail

_childToRecycleback to summary
protected CBORWriteContext _childToRecycle
_currentNameback to summary
protected String _currentName

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

_currentPropertyIdback to summary
protected long _currentPropertyId

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

_currentValueback to summary
protected Object _currentValue
_dupsback to summary
protected DupDetector _dups
_gotPropertyIdback to summary
protected boolean _gotPropertyId

Marker used to indicate that we just wrote a property 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 StreamWriteException
assignCurrentValueback to summary
public void assignCurrentValue(Object v)

Overrides tools.jackson.core.TokenStreamContext.assignCurrentValue.

Doc from tools.jackson.core.TokenStreamContext.assignCurrentValue.

Method to call to pass value to be returned via currentValue; typically called indirectly through JsonParser#assignCurrentValue or JsonGenerator#assignCurrentValue).

Annotations
@Override
clearAndGetParentback to summary
public CBORWriteContext clearAndGetParent()

Method that can be used to both clear the accumulated references (specifically value set with assignCurrentValue(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)
currentNameback to summary
public final String currentName()

Implements abstract tools.jackson.core.TokenStreamContext.currentName.

Doc from tools.jackson.core.TokenStreamContext.currentName.

Method for accessing name associated with the current location. Non-null for PROPERTY_NAME and value events that directly follow Property names; null for root level and array values.

Annotations
@Override
currentValueback to summary
public Object currentValue()

Overrides tools.jackson.core.TokenStreamContext.currentValue.

Doc from tools.jackson.core.TokenStreamContext.currentValue.

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.

Annotations
@Override
getDupDetectorback to summary
public DupDetector getDupDetector()
getParentback to summary
public final CBORWriteContext getParent()

Implements abstract tools.jackson.core.TokenStreamContext.getParent.

Doc from tools.jackson.core.TokenStreamContext.getParent.

Accessor for finding parent context of this context; will return null for root context.

Annotations
@Override
hasCurrentNameback to summary
public boolean hasCurrentName()

Overrides tools.jackson.core.TokenStreamContext.hasCurrentName.

Annotations
@Override
resetback to summary
private CBORWriteContext reset(int type, Object currentValue)
withDupDetectorback to summary
public CBORWriteContext withDupDetector(DupDetector dups)
writeNameback to summary
public boolean writeName(String name) throws StreamWriteException

Method that writer is to call before it writes an Object property name.

Returns:boolean

Ok if name writing should proceed

writePropertyIdback to summary
public boolean writePropertyId(long propertyId) throws StreamWriteException
writeValueback to summary
public boolean writeValue()