com.fasterxml.jackson.core.json

Class 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 Detail

      • _parent

        protected final JsonReadContext _parent
        Parent context for this context; null for root context.
      • _currentName

        protected String _currentName
      • _currentValue

        protected Object _currentValue
        Since:
        2.5
      • _lineNr

        protected int _lineNr
      • _columnNr

        protected int _columnNr
    • Constructor Detail

    • Method Detail

      • reset

        public void reset(int type,
                          int lineNr,
                          int colNr)
        Internal method to allow instance reuse: DO NOT USE unless you absolutely know what you are doing. Clears up state (including "current value"), changes type to one specified; resets current duplicate-detection state (if any). Parent link left as-is since it is final.

        NOTE: Public since 2.12.

      • getCurrentValue

        public 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.
      • createChildArrayContext

        public JsonReadContext createChildArrayContext(int lineNr,
                                                       int colNr)
      • createChildObjectContext

        public JsonReadContext createChildObjectContext(int lineNr,
                                                        int colNr)
      • getCurrentName

        public 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
      • getStartLocation

        public JsonLocation getStartLocation(Object srcRef)
        Description copied from class: JsonStreamContext
        Optional method that may be used to access starting location of this context: for example, in case of JSON `Object` context, offset at which `[` token was read or written. Often used for error reporting purposes. Implementations that do not keep track of such location are expected to return JsonLocation.NA; this is what the default implementation does.
        Overrides:
        getStartLocation in class JsonStreamContext
        Returns:
        Location pointing to the point where the context start marker was found (or written); never `null`.

        NOTE: demoted from JsonReadContext in 2.9, to allow use for "non-standard" read contexts.

      • expectComma

        public boolean expectComma()

Copyright © 2008–2020 FasterXML. All rights reserved.