com.fasterxml.jackson.core.json

## Class JsonWriteContext

- java.lang.Object
- - com.fasterxml.jackson.core.JsonStreamContext
  - - com.fasterxml.jackson.core.json.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 Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected JsonWriteContext` | `_child`
    `protected String` | `_currentName` Name of the field of which value is to be parsed; only used for OBJECT contexts
    `protected DupDetector` | `_dups`
    `protected boolean` | `_gotName` Marker used to indicate that we just received a name, and now expect a value
    `protected JsonWriteContext` | `_parent` Parent context for this context; null for root context.
    `static int` | `STATUS_EXPECT_NAME`
    `static int` | `STATUS_EXPECT_VALUE`
    `static int` | `STATUS_OK_AFTER_COLON`
    `static int` | `STATUS_OK_AFTER_COMMA`
    `static int` | `STATUS_OK_AFTER_SPACE`
    `static int` | `STATUS_OK_AS_IS`

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

      `_index, _type, TYPE_ARRAY, TYPE_OBJECT, TYPE_ROOT`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JsonWriteContext(int type, JsonWriteContext parent, DupDetector dups)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `appendDesc(StringBuilder sb)`
    `JsonWriteContext` | `createChildArrayContext()`
    `JsonWriteContext` | `createChildObjectContext()`
    `static JsonWriteContext` | `createRootContext()` Deprecated. Since 2.3; use method that takes argument
    `static JsonWriteContext` | `createRootContext(DupDetector dd)`
    `String` | `getCurrentName()` Method for accessing name associated with the current location.
    `JsonWriteContext` | `getParent()` Accessor for finding parent context of this context; will return null for root context.
    `protected JsonWriteContext` | `reset(int type)`
    `String` | `toString()` Overridden to provide developer writeable "JsonPath" representation of the context.
    `int` | `writeFieldName(String name)` Method that writer is to call before it writes a field name.
    `int` | `writeValue()`

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

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

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

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

- - ### Field Detail

    - #### STATUS_OK_AS_IS

          public static final int STATUS_OK_AS_IS

      See Also:
        Constant Field Values

    - #### STATUS_OK_AFTER_COMMA

          public static final int STATUS_OK_AFTER_COMMA

      See Also:
        Constant Field Values

    - #### STATUS_OK_AFTER_COLON

          public static final int STATUS_OK_AFTER_COLON

      See Also:
        Constant Field Values

    - #### STATUS_OK_AFTER_SPACE

          public static final int STATUS_OK_AFTER_SPACE

      See Also:
        Constant Field Values

    - #### STATUS_EXPECT_VALUE

          public static final int STATUS_EXPECT_VALUE

      See Also:
        Constant Field Values

    - #### STATUS_EXPECT_NAME

          public static final int STATUS_EXPECT_NAME

      See Also:
        Constant Field Values

    - #### _parent

          protected final JsonWriteContext _parent

      Parent context for this context; null for root context.

    - #### _dups

          protected final DupDetector _dups

    - #### _child

          protected JsonWriteContext _child

    - #### _currentName

          protected String _currentName

      Name of the field of which value is to be parsed; only used for OBJECT contexts

    - #### _gotName

          protected boolean _gotName

      Marker used to indicate that we just received a name, and now expect a value

  - ### Constructor Detail

    - #### JsonWriteContext

          protected JsonWriteContext(int type,
                          JsonWriteContext parent,
                          DupDetector dups)

  - ### Method Detail

    - #### reset

          protected JsonWriteContext reset(int type)

    - #### createRootContext

          @Deprecated
          public static JsonWriteContext createRootContext()

      Deprecated. Since 2.3; use method that takes argument

    - #### createRootContext

          public static JsonWriteContext createRootContext(DupDetector dd)

    - #### createChildArrayContext

          public JsonWriteContext createChildArrayContext()

    - #### createChildObjectContext

          public JsonWriteContext createChildObjectContext()

    - #### getParent

          public final JsonWriteContext 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`

    - #### 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`

    - #### writeFieldName

          public final int writeFieldName(String name)
                                   throws JsonProcessingException

      Method that writer is to call before it writes a field name.
      Returns:
        Index of the field entry (0-based)
      Throws:
        `JsonProcessingException`

    - #### writeValue

          public final int writeValue()

    - #### appendDesc

          protected void appendDesc(StringBuilder sb)

    - #### toString

          public String toString()

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

Copyright © 2014 FasterXML. All Rights Reserved.