Package org.codehaus.jackson.impl
Class JsonWriteContext
- java.lang.Object
-
- org.codehaus.jackson.JsonStreamContext
-
- org.codehaus.jackson.impl.JsonWriteContext
-
public class JsonWriteContext extends JsonStreamContext
Extension ofJsonStreamContext, which implements core methods needed, and also exposes more complete API to generator implementation classes.
-
-
Field Summary
Fields Modifier and Type Field Description protected JsonWriteContext_childprotected java.lang.String_currentNameName of the field of which value is to be parsed; only used for OBJECT contextsprotected JsonWriteContext_parentstatic intSTATUS_EXPECT_NAMEstatic intSTATUS_EXPECT_VALUEstatic intSTATUS_OK_AFTER_COLONstatic intSTATUS_OK_AFTER_COMMAstatic intSTATUS_OK_AFTER_SPACEstatic intSTATUS_OK_AS_IS-
Fields inherited from class org.codehaus.jackson.JsonStreamContext
_index, _type, TYPE_ARRAY, TYPE_OBJECT, TYPE_ROOT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJsonWriteContext(int type, JsonWriteContext parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendDesc(java.lang.StringBuilder sb)JsonWriteContextcreateChildArrayContext()JsonWriteContextcreateChildObjectContext()static JsonWriteContextcreateRootContext()java.lang.StringgetCurrentName()Method for accessing name associated with the current location.JsonWriteContextgetParent()Accessor for finding parent context of this context; will return null for root context.java.lang.StringtoString()Overridden to provide developer writeable "JsonPath" representation of the context.intwriteFieldName(java.lang.String name)Method that writer is to call before it writes a field name.intwriteValue()-
Methods inherited from class org.codehaus.jackson.JsonStreamContext
getCurrentIndex, getEntryCount, getTypeDesc, inArray, inObject, inRoot
-
-
-
-
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
-
_currentName
protected java.lang.String _currentName
Name of the field of which value is to be parsed; only used for OBJECT contexts
-
_child
protected JsonWriteContext _child
-
-
Constructor Detail
-
JsonWriteContext
protected JsonWriteContext(int type, JsonWriteContext parent)
-
-
Method Detail
-
createRootContext
public static JsonWriteContext createRootContext()
-
createChildArrayContext
public final JsonWriteContext createChildArrayContext()
-
createChildObjectContext
public final JsonWriteContext createChildObjectContext()
-
getParent
public final JsonWriteContext getParent()
Description copied from class:JsonStreamContextAccessor for finding parent context of this context; will return null for root context.- Specified by:
getParentin classJsonStreamContext
-
getCurrentName
public final java.lang.String getCurrentName()
Description copied from class:JsonStreamContextMethod for accessing name associated with the current location. Non-null forFIELD_NAMEand value events that directly follow field names; null for root level and array values.- Specified by:
getCurrentNamein classJsonStreamContext
-
writeFieldName
public final int writeFieldName(java.lang.String name)
Method that writer is to call before it writes a field name.- Returns:
- Index of the field entry (0-based)
-
writeValue
public final int writeValue()
-
appendDesc
protected final void appendDesc(java.lang.StringBuilder sb)
-
toString
public final java.lang.String toString()
Overridden to provide developer writeable "JsonPath" representation of the context.- Overrides:
toStringin classjava.lang.Object
-
-