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 Details

    • _parent

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

      protected com.fasterxml.jackson.core.json.DupDetector _dups
    • _childToRecycle

      protected CBORWriteContext _childToRecycle
    • _currentName

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

      protected Object _currentValue
    • _currentFieldId

      protected long _currentFieldId
      Alternative to _currentName used for integer/long-valued Maps.
    • _gotFieldId

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

    • CBORWriteContext

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

    • reset

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

      public CBORWriteContext withDupDetector(com.fasterxml.jackson.core.json.DupDetector dups)
    • getCurrentValue

      public Object getCurrentValue()
      Overrides:
      getCurrentValue in class com.fasterxml.jackson.core.JsonStreamContext
    • setCurrentValue

      public void setCurrentValue(Object v)
      Overrides:
      setCurrentValue in class com.fasterxml.jackson.core.JsonStreamContext
    • createRootContext

      public static CBORWriteContext createRootContext(com.fasterxml.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 com.fasterxml.jackson.core.JsonStreamContext
    • getCurrentName

      public final String getCurrentName()
      Specified by:
      getCurrentName in class com.fasterxml.jackson.core.JsonStreamContext
    • hasCurrentName

      public boolean hasCurrentName()
      Overrides:
      hasCurrentName in class com.fasterxml.jackson.core.JsonStreamContext
    • clearAndGetParent

      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.
    • 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()