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 Details

    • _parent

      protected final CBORWriteContext _parent
      Parent context for this context; null for root context.
    • _dups

      protected tools.jackson.core.json.DupDetector _dups
    • _childToRecycle

      protected CBORWriteContext _childToRecycle
    • _currentName

      protected String _currentName
      Name of the Object property of which value is to be written; only used for OBJECT contexts
    • _currentValue

      protected Object _currentValue
    • _currentPropertyId

      protected long _currentPropertyId
      Alternative to _currentName used for integer/long-valued Maps.
    • _gotPropertyId

      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
  • Constructor Details

    • CBORWriteContext

      protected CBORWriteContext(int type, CBORWriteContext parent, tools.jackson.core.json.DupDetector dups, Object currentValue)
  • Method Details

    • reset

      private CBORWriteContext reset(int type, Object currentValue)
    • withDupDetector

      public CBORWriteContext withDupDetector(tools.jackson.core.json.DupDetector dups)
    • currentValue

      public Object currentValue()
      Overrides:
      currentValue in class tools.jackson.core.TokenStreamContext
    • assignCurrentValue

      public void assignCurrentValue(Object v)
      Overrides:
      assignCurrentValue in class tools.jackson.core.TokenStreamContext
    • createRootContext

      public static CBORWriteContext createRootContext(tools.jackson.core.json.DupDetector dd)
    • createChildArrayContext

      public CBORWriteContext createChildArrayContext(Object currentValue)
    • createChildObjectContext

      public CBORWriteContext createChildObjectContext(Object currentValue)
    • getParent

      public final CBORWriteContext getParent()
      Specified by:
      getParent in class tools.jackson.core.TokenStreamContext
    • currentName

      public final String currentName()
      Specified by:
      currentName in class tools.jackson.core.TokenStreamContext
    • hasCurrentName

      public boolean hasCurrentName()
      Overrides:
      hasCurrentName in class tools.jackson.core.TokenStreamContext
    • clearAndGetParent

      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.
    • getDupDetector

      public tools.jackson.core.json.DupDetector getDupDetector()
    • writeName

      public boolean writeName(String name) throws tools.jackson.core.exc.StreamWriteException
      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()