Top Description Fields Constructors Methods
tools.jackson.core.util

public final Class SimpleStreamWriteContext

extends TokenStreamContext
Class Inheritance
Imports
tools.jackson.core.*, tools.jackson.core.exc.StreamWriteException, tools.jackson.core.json.DupDetector

Basic implementation of TokenStreamContext useful for most format backend JsonGenerator implementations (with notable exception of JSON that needs bit more advanced state).
Since
3.0

Field Summary

Modifier and TypeField and Description
protected SimpleStreamWriteContext
protected String
_currentName

Name of the property of which value is to be written; only used for OBJECT contexts.

protected Object
protected DupDetector
protected boolean
_gotPropertyId

Marker used to indicate that we just wrote a property name (or possibly property id for some backends) and now expect a value to write.

protected final SimpleStreamWriteContext
_parent

Parent context for this context; null for root context.

Inherited from tools.jackson.core.TokenStreamContext:
_index_nestingDepth_typeTYPE_ARRAYTYPE_OBJECTTYPE_ROOT

Constructor Summary

AccessConstructor and Description
protected
SimpleStreamWriteContext(int type, SimpleStreamWriteContext parent, int nestingDepth, DupDetector dups, Object currentValue)

Method Summary

Modifier and TypeMethod and Description
private final void
public void
assignCurrentValue(Object v)

Overrides tools.jackson.core.TokenStreamContext.assignCurrentValue.

Method to call to pass value to be returned via currentValue; typically called indirectly through JsonParser#assignCurrentValue or JsonGenerator#assignCurrentValue).

public SimpleStreamWriteContext

Returns:

Parent context of this context node, if any; null for root context
clearAndGetParent
()

Method that can be used to both clear the accumulated references (specifically value set with assignCurrentValue(Object)) that should not be retained, and returns parent (as would getParent() do).

public SimpleStreamWriteContext
public SimpleStreamWriteContext
public static SimpleStreamWriteContext
public final String
currentName()

Implements abstract tools.jackson.core.TokenStreamContext.currentName.

Method for accessing name associated with the current location.

public Object
currentValue()

Overrides tools.jackson.core.TokenStreamContext.currentValue.

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.

public DupDetector
public final SimpleStreamWriteContext
getParent()

Implements abstract tools.jackson.core.TokenStreamContext.getParent.

Accessor for finding parent context of this context; will return null for root context.

public boolean
private SimpleStreamWriteContext
reset(int type, Object currentValue)

public SimpleStreamWriteContext
public boolean

Returns:

True if name writing should proceed; false if not
writeName
(String
Name of Object property name being written
name
)

Method that writer is to call before it writes an Object Property name.

public boolean
Inherited from tools.jackson.core.TokenStreamContext:
getCurrentIndexgetEntryCountgetNestingDepthhasCurrentIndexhasPathSegmentinArrayinObjectinRootpathAsPointerpathAsPointerstartLocationtoStringtypeDesc

Field Detail

_childToRecycleback to summary
protected SimpleStreamWriteContext _childToRecycle
_currentNameback to summary
protected String _currentName

Name of the property of which value is to be written; only used for OBJECT contexts.

_currentValueback to summary
protected Object _currentValue
_dupsback to summary
protected DupDetector _dups
_gotPropertyIdback to summary
protected boolean _gotPropertyId

Marker used to indicate that we just wrote a property name (or possibly property id for some backends) and now expect a value to write.

_parentback to summary
protected final SimpleStreamWriteContext _parent

Parent context for this context; null for root context.

Constructor Detail

SimpleStreamWriteContextback to summary
protected SimpleStreamWriteContext(int type, SimpleStreamWriteContext parent, int nestingDepth, DupDetector dups, Object currentValue)

Method Detail

_checkDupback to summary
private final void _checkDup(DupDetector dd, String name) throws StreamWriteException
assignCurrentValueback to summary
public void assignCurrentValue(Object v)

Overrides tools.jackson.core.TokenStreamContext.assignCurrentValue.

Doc from tools.jackson.core.TokenStreamContext.assignCurrentValue.

Method to call to pass value to be returned via currentValue; typically called indirectly through JsonParser#assignCurrentValue or JsonGenerator#assignCurrentValue).

Annotations
@Override
clearAndGetParentback to summary
public SimpleStreamWriteContext clearAndGetParent()

Method that can be used to both clear the accumulated references (specifically value set with assignCurrentValue(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.

Returns:SimpleStreamWriteContext

Parent context of this context node, if any; null for root context

createChildArrayContextback to summary
public SimpleStreamWriteContext createChildArrayContext(Object currentValue)
createChildObjectContextback to summary
public SimpleStreamWriteContext createChildObjectContext(Object currentValue)
createRootContextback to summary
public static SimpleStreamWriteContext createRootContext(DupDetector dd)
currentNameback to summary
public final String currentName()

Implements abstract tools.jackson.core.TokenStreamContext.currentName.

Doc from tools.jackson.core.TokenStreamContext.currentName.

Method for accessing name associated with the current location. Non-null for PROPERTY_NAME and value events that directly follow Property names; null for root level and array values.

Annotations
@Override
currentValueback to summary
public Object currentValue()

Overrides tools.jackson.core.TokenStreamContext.currentValue.

Doc from tools.jackson.core.TokenStreamContext.currentValue.

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.

Annotations
@Override
getDupDetectorback to summary
public DupDetector getDupDetector()
getParentback to summary
public final SimpleStreamWriteContext getParent()

Implements abstract tools.jackson.core.TokenStreamContext.getParent.

Doc from tools.jackson.core.TokenStreamContext.getParent.

Accessor for finding parent context of this context; will return null for root context.

Annotations
@Override
hasCurrentNameback to summary
public boolean hasCurrentName()

Overrides tools.jackson.core.TokenStreamContext.hasCurrentName.

Annotations
@Override
resetback to summary
private SimpleStreamWriteContext reset(int type, Object currentValue)
withDupDetectorback to summary
public SimpleStreamWriteContext withDupDetector(DupDetector dups)
writeNameback to summary
public boolean writeName(String name) throws StreamWriteException

Method that writer is to call before it writes an Object Property name.

Parameters
name:String

Name of Object property name being written

Returns:boolean

True if name writing should proceed; false if not

Exceptions
StreamWriteException:
If write fails due to duplicate check
writeValueback to summary
public boolean writeValue()