com.fasterxml.jackson.core.json

Class JsonWriteContext



  • public class JsonWriteContext
    extends JsonStreamContext
    Extension of JsonStreamContext, which implements core methods needed, and also exposes more complete API to generator implementation classes.
    • Field Detail

      • _parent

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

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

        protected Object _currentValue
        Since:
        2.5
      • _gotName

        protected boolean _gotName
        Marker used to indicate that we just wrote a name, and now expect a value to write
    • Method Detail

      • reset

        public JsonWriteContext reset(int type)
        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.

      • reset

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

        NOTE: Public since 2.12.

        Since:
        2.10
      • 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.
      • createRootContext

        @Deprecated
        public static JsonWriteContext createRootContext()
        Deprecated. Since 2.3; use method that takes argument
      • getCurrentName

        public final 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
      • writeValue

        public int writeValue()

Copyright © 2008–2020 FasterXML. All rights reserved.