com.fasterxml.jackson.dataformat.protobuf

## Class ProtobufReadContext

- java.lang.Object
- - com.fasterxml.jackson.core.JsonStreamContext
  - - com.fasterxml.jackson.dataformat.protobuf.ProtobufReadContext

-     public final class ProtobufReadContext
      extends com.fasterxml.jackson.core.JsonStreamContext

  Replacement of `JsonReadContext` to support features needed to decode nested Protobuf messages.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ProtobufReadContext` | `_child`
    `protected String` | `_currentName`
    `protected Object` | `_currentValue`
    `protected int` | `_endOffset` Offset within input buffer where the message represented by this context (if message context) ends.
    `protected ProtobufField` | `_field` For array contexts: field that defines type of array values.
    `protected ProtobufMessage` | `_messageType` Type of current context.
    `protected ProtobufReadContext` | `_parent` Parent context for this context; null for root context.

    - ### Fields inherited from class com.fasterxml.jackson.core.JsonStreamContext

      `_index, _type, TYPE_ARRAY, TYPE_OBJECT, TYPE_ROOT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProtobufReadContext(ProtobufReadContext parent, ProtobufMessage messageType, int type, int endOffset)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `adjustEnd(int bytesConsumed)` Method called when loading more input, or moving existing data; this requires adjusting relative end offset as well, except for root context.
    `ProtobufReadContext` | `createChildArrayContext(ProtobufField f)`
    `ProtobufReadContext` | `createChildArrayContext(ProtobufField f, int endOffset)`
    `ProtobufReadContext` | `createChildObjectContext(ProtobufMessage messageType, ProtobufField f, int endOffset)`
    `static ProtobufReadContext` | `createRootContext()`
    `String` | `getCurrentName()`
    `Object` | `getCurrentValue()`
    `int` | `getEndOffset()`
    `ProtobufField` | `getField()`
    `ProtobufMessage` | `getMessageType()`
    `ProtobufReadContext` | `getParent()`
    `com.fasterxml.jackson.core.JsonLocation` | `getStartLocation(Object srcRef, long byteOffset)`
    `protected void` | `reset(ProtobufMessage messageType, int type, int endOffset)`
    `void` | `setCurrentName(String name)`
    `void` | `setCurrentValue(Object v)`
    `void` | `setMessageType(ProtobufMessage mt)`
    `String` | `toString()` Overridden to provide developer readable "JsonPath" representation of the context.

    - ### Methods inherited from class com.fasterxml.jackson.core.JsonStreamContext

      `getCurrentIndex, getEntryCount, getStartLocation, getTypeDesc, hasCurrentIndex, hasCurrentName, hasPathSegment, inArray, inObject, inRoot, pathAsPointer, pathAsPointer, typeDesc`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### _parent

          protected final ProtobufReadContext _parent

      Parent context for this context; null for root context.

    - #### _messageType

          protected ProtobufMessage _messageType

      Type of current context.

    - #### _field

          protected ProtobufField _field

      For array contexts: field that defines type of array values.

    - #### _currentName

          protected String _currentName

    - #### _currentValue

          protected Object _currentValue

      Since:
        2.9

    - #### _endOffset

          protected int _endOffset

      Offset within input buffer where the message represented by this context (if message context) ends.

    - #### _child

          protected ProtobufReadContext _child

  - ### Constructor Detail

    - #### ProtobufReadContext

          public ProtobufReadContext(ProtobufReadContext parent,
                             ProtobufMessage messageType,
                             int type,
                             int endOffset)

  - ### Method Detail

    - #### reset

          protected void reset(ProtobufMessage messageType,
                   int type,
                   int endOffset)

    - #### 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 ProtobufReadContext createRootContext()

    - #### createChildArrayContext

          public ProtobufReadContext createChildArrayContext(ProtobufField f)

    - #### createChildArrayContext

          public ProtobufReadContext createChildArrayContext(ProtobufField f,
                                                    int endOffset)

    - #### createChildObjectContext

          public ProtobufReadContext createChildObjectContext(ProtobufMessage messageType,
                                                     ProtobufField f,
                                                     int endOffset)

    - #### getCurrentName

          public String getCurrentName()

      Specified by:
        `getCurrentName` in class `com.fasterxml.jackson.core.JsonStreamContext`

    - #### getParent

          public ProtobufReadContext getParent()

      Specified by:
        `getParent` in class `com.fasterxml.jackson.core.JsonStreamContext`

    - #### adjustEnd

          public int adjustEnd(int bytesConsumed)

      Method called when loading more input, or moving existing data; this requires adjusting relative end offset as well, except for root context.

    - #### getEndOffset

          public int getEndOffset()

    - #### getMessageType

          public ProtobufMessage getMessageType()

    - #### getField

          public ProtobufField getField()

    - #### setMessageType

          public void setMessageType(ProtobufMessage mt)

    - #### getStartLocation

          public com.fasterxml.jackson.core.JsonLocation getStartLocation(Object srcRef,
                                                                 long byteOffset)

      Returns:
        Location pointing to the point where the context start marker was found

    - #### setCurrentName

          public void setCurrentName(String name)

    - #### toString

          public String toString()

      Overridden to provide developer readable "JsonPath" representation of the context.
      Overrides:
        `toString` in class `com.fasterxml.jackson.core.JsonStreamContext`

Copyright © 2017 FasterXML. All rights reserved.