JsonReadContext
Date: 2016-12-03

com.fasterxml.jackson.core.json

## Class JsonReadContext

- java.lang.Object
- - com.fasterxml.jackson.core.JsonStreamContext
  - - com.fasterxml.jackson.core.json.JsonReadContext

-     public final class JsonReadContext
      extends JsonStreamContext

  Extension of `JsonStreamContext`, which implements core methods needed, and also exposes more complete API to parser implementation classes.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected JsonReadContext` | `_child`
    `protected int` | `_columnNr`
    `protected java.lang.String` | `_currentName`
    `protected java.lang.Object` | `_currentValue`
    `protected DupDetector` | `_dups`
    `protected int` | `_lineNr`
    `protected JsonReadContext` | `_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
    `JsonReadContext(JsonReadContext parent, DupDetector dups, int type, int lineNr, int colNr)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `JsonReadContext` | `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).
    `JsonReadContext` | `createChildArrayContext(int lineNr, int colNr)`
    `JsonReadContext` | `createChildObjectContext(int lineNr, int colNr)`
    `static JsonReadContext` | `createRootContext(DupDetector dups)`
    `static JsonReadContext` | `createRootContext(int lineNr, int colNr, DupDetector dups)`
    `boolean` | `expectComma()`
    `java.lang.String` | `getCurrentName()` Method for accessing name associated with the current location.
    `java.lang.Object` | `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.
    `DupDetector` | `getDupDetector()`
    `JsonReadContext` | `getParent()` Accessor for finding parent context of this context; will return null for root context.
    `JsonLocation` | `getStartLocation(java.lang.Object srcRef)`
    `protected void` | `reset(int type, int lineNr, int colNr)`
    `void` | `setCurrentName(java.lang.String name)`
    `void` | `setCurrentValue(java.lang.Object v)` Method to call to pass value to be returned via `JsonStreamContext.getCurrentValue()`; typically called indirectly through `JsonParser.setCurrentValue(java.lang.Object)` or `JsonGenerator.setCurrentValue(java.lang.Object)`).
    `java.lang.String` | `toString()` Overridden to provide developer readable "JsonPath" representation of the context.
    `JsonReadContext` | `withDupDetector(DupDetector dups)`

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

      `getCurrentIndex, getEntryCount, getTypeDesc, inArray, inObject, inRoot, typeDesc`

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

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

- - ### Field Detail

    - #### _parent

          protected final JsonReadContext _parent

      Parent context for this context; null for root context.

    - #### _dups

          protected DupDetector _dups

    - #### _child

          protected JsonReadContext _child

    - #### _currentName

          protected java.lang.String _currentName

    - #### _currentValue

          protected java.lang.Object _currentValue

      Since:
        2.5

    - #### _lineNr

          protected int _lineNr

    - #### _columnNr

          protected int _columnNr

  - ### Constructor Detail

    - #### JsonReadContext

          public JsonReadContext(JsonReadContext parent,
                         DupDetector dups,
                         int type,
                         int lineNr,
                         int colNr)

  - ### Method Detail

    - #### reset

          protected void reset(int type,
                   int lineNr,
                   int colNr)

    - #### withDupDetector

          public JsonReadContext withDupDetector(DupDetector dups)

    - #### getCurrentValue

          public java.lang.Object getCurrentValue()

      Description copied from class: `JsonStreamContext`
      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.

      Overrides:
        `getCurrentValue` in class `JsonStreamContext`
      Returns:
        Currently active value, if one has been assigned.

    - #### setCurrentValue

          public void setCurrentValue(java.lang.Object v)

      Description copied from class: `JsonStreamContext`
      Method to call to pass value to be returned via `JsonStreamContext.getCurrentValue()`; typically called indirectly through `JsonParser.setCurrentValue(java.lang.Object)` or `JsonGenerator.setCurrentValue(java.lang.Object)`).
      Overrides:
        `setCurrentValue` in class `JsonStreamContext`

    - #### createRootContext

          public static JsonReadContext createRootContext(int lineNr,
                                          int colNr,
                                          DupDetector dups)

    - #### createRootContext

          public static JsonReadContext createRootContext(DupDetector dups)

    - #### createChildArrayContext

          public JsonReadContext createChildArrayContext(int lineNr,
                                                int colNr)

    - #### createChildObjectContext

          public JsonReadContext createChildObjectContext(int lineNr,
                                                 int colNr)

    - #### getCurrentName

          public java.lang.String getCurrentName()

      Description copied from class: `JsonStreamContext`
      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.
      Specified by:
        `getCurrentName` in class `JsonStreamContext`

    - #### getParent

          public JsonReadContext getParent()

      Description copied from class: `JsonStreamContext`
      Accessor for finding parent context of this context; will return null for root context.
      Specified by:
        `getParent` in class `JsonStreamContext`

    - #### clearAndGetParent

          public JsonReadContext 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`.
      Since:
        2.7

    - #### getStartLocation

          public JsonLocation getStartLocation(java.lang.Object srcRef)

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

    - #### getDupDetector

          public DupDetector getDupDetector()

    - #### expectComma

          public boolean expectComma()

    - #### setCurrentName

          public void setCurrentName(java.lang.String name)
                              throws JsonProcessingException

      Throws:
        `JsonProcessingException`

    - #### toString

          public java.lang.String toString()

      Overridden to provide developer readable "JsonPath" representation of the context.
      Overrides:
        `toString` in class `java.lang.Object`