public class JsonWriteContext extends JsonStreamContext
JsonStreamContext, which implements
 core methods needed, and also exposes
 more complete API to generator implementation classes.| Modifier and Type | Field and Description | 
|---|---|
| protected JsonWriteContext | _child | 
| protected String | _currentNameName of the field of which value is to be written; only
 used for OBJECT contexts | 
| protected Object | _currentValue | 
| protected DupDetector | _dups | 
| protected boolean | _gotNameMarker used to indicate that we just wrote a name, and
 now expect a value to write | 
| protected JsonWriteContext | _parentParent 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 | 
_index, _type, TYPE_ARRAY, TYPE_OBJECT, TYPE_ROOT| Modifier | Constructor and Description | 
|---|---|
| protected  | JsonWriteContext(int type,
                JsonWriteContext parent,
                DupDetector dups) | 
| protected  | JsonWriteContext(int type,
                JsonWriteContext parent,
                DupDetector dups,
                Object currValue) | 
| Modifier and Type | Method and Description | 
|---|---|
| JsonWriteContext | 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 wouldgetParent()do). | 
| JsonWriteContext | createChildArrayContext() | 
| JsonWriteContext | createChildArrayContext(Object currValue) | 
| JsonWriteContext | createChildObjectContext() | 
| JsonWriteContext | createChildObjectContext(Object currValue) | 
| 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. | 
| 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() | 
| JsonWriteContext | getParent()Accessor for finding parent context of this context; will
 return null for root context. | 
| boolean | hasCurrentName() | 
| protected JsonWriteContext | reset(int type) | 
| protected JsonWriteContext | reset(int type,
     Object currValue) | 
| void | setCurrentValue(Object v)Method to call to pass value to be returned via  JsonStreamContext.getCurrentValue(); typically
 called indirectly throughJsonParser.setCurrentValue(java.lang.Object)orJsonGenerator.setCurrentValue(java.lang.Object)). | 
| JsonWriteContext | withDupDetector(DupDetector dups) | 
| int | writeFieldName(String name)Method that writer is to call before it writes a field name. | 
| int | writeValue() | 
getCurrentIndex, getEntryCount, getStartLocation, getTypeDesc, hasCurrentIndex, hasPathSegment, inArray, inObject, inRoot, pathAsPointer, pathAsPointer, toString, typeDescpublic static final int STATUS_OK_AS_IS
public static final int STATUS_OK_AFTER_COMMA
public static final int STATUS_OK_AFTER_COLON
public static final int STATUS_OK_AFTER_SPACE
public static final int STATUS_EXPECT_VALUE
public static final int STATUS_EXPECT_NAME
protected final JsonWriteContext _parent
protected DupDetector _dups
protected JsonWriteContext _child
protected String _currentName
protected Object _currentValue
protected boolean _gotName
protected JsonWriteContext(int type,
                           JsonWriteContext parent,
                           DupDetector dups)
protected JsonWriteContext(int type,
                           JsonWriteContext parent,
                           DupDetector dups,
                           Object currValue)
protected JsonWriteContext reset(int type)
protected JsonWriteContext reset(int type, Object currValue)
public JsonWriteContext withDupDetector(DupDetector dups)
public Object getCurrentValue()
JsonStreamContextNote 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.
getCurrentValue in class JsonStreamContextpublic void setCurrentValue(Object v)
JsonStreamContextJsonStreamContext.getCurrentValue(); typically
 called indirectly through JsonParser.setCurrentValue(java.lang.Object)
 or JsonGenerator.setCurrentValue(java.lang.Object)).setCurrentValue in class JsonStreamContext@Deprecated public static JsonWriteContext createRootContext()
public static JsonWriteContext createRootContext(DupDetector dd)
public JsonWriteContext createChildArrayContext()
public JsonWriteContext createChildArrayContext(Object currValue)
public JsonWriteContext createChildObjectContext()
public JsonWriteContext createChildObjectContext(Object currValue)
public final JsonWriteContext getParent()
JsonStreamContextgetParent in class JsonStreamContextpublic final String getCurrentName()
JsonStreamContextFIELD_NAME and value events that directly
 follow field names; null for root level and array values.getCurrentName in class JsonStreamContextpublic boolean hasCurrentName()
hasCurrentName in class JsonStreamContextpublic JsonWriteContext clearAndGetParent()
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.public DupDetector getDupDetector()
public int writeFieldName(String name) throws JsonProcessingException
JsonProcessingExceptionpublic int writeValue()
Copyright © 2008–2019 FasterXML. All rights reserved.