Class SmileWriteContext
- java.lang.Object
-
- com.fasterxml.jackson.core.JsonStreamContext
-
- com.fasterxml.jackson.dataformat.smile.SmileWriteContext
-
public final class SmileWriteContext extends com.fasterxml.jackson.core.JsonStreamContextReplacement forJsonWriteContext; while not strictly needed is more streamlined, optimal since there's no need to keep track of separators etc.- Since:
- 2.10
-
-
Field Summary
Fields Modifier and Type Field Description protected SmileWriteContext_childToRecycleprotected java.lang.String_currentNameName of the field of which value is to be written; only used for OBJECT contextsprotected java.lang.Object_currentValueprotected com.fasterxml.jackson.core.json.DupDetector_dupsprotected boolean_gotFieldIdMarker used to indicate that we just wrote a field name (or Map name / id) and now expect a value to writeprotected SmileWriteContext_parentParent context for this context; null for root context.
-
Constructor Summary
Constructors Modifier Constructor Description protectedSmileWriteContext(int type, SmileWriteContext parent, com.fasterxml.jackson.core.json.DupDetector dups, java.lang.Object currentValue)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_checkDup(com.fasterxml.jackson.core.json.DupDetector dd, java.lang.String name)SmileWriteContextclearAndGetParent()Method that can be used to both clear the accumulated references (specifically value set withsetCurrentValue(Object)) that should not be retained, and returns parent (as wouldgetParent()do).SmileWriteContextcreateChildArrayContext(java.lang.Object currentValue)SmileWriteContextcreateChildObjectContext(java.lang.Object currentValue)static SmileWriteContextcreateRootContext(com.fasterxml.jackson.core.json.DupDetector dd)java.lang.StringgetCurrentName()java.lang.ObjectgetCurrentValue()com.fasterxml.jackson.core.json.DupDetectorgetDupDetector()SmileWriteContextgetParent()booleanhasCurrentName()private SmileWriteContextreset(int type, java.lang.Object currentValue)voidsetCurrentValue(java.lang.Object v)SmileWriteContextwithDupDetector(com.fasterxml.jackson.core.json.DupDetector dups)booleanwriteFieldName(java.lang.String name)Method that writer is to call before it writes a field name.booleanwriteValue()
-
-
-
Field Detail
-
_parent
protected final SmileWriteContext _parent
Parent context for this context; null for root context.
-
_dups
protected com.fasterxml.jackson.core.json.DupDetector _dups
-
_childToRecycle
protected SmileWriteContext _childToRecycle
-
_currentName
protected java.lang.String _currentName
Name of the field of which value is to be written; only used for OBJECT contexts
-
_currentValue
protected java.lang.Object _currentValue
-
_gotFieldId
protected boolean _gotFieldId
Marker used to indicate that we just wrote a field name (or Map name / id) and now expect a value to write
-
-
Constructor Detail
-
SmileWriteContext
protected SmileWriteContext(int type, SmileWriteContext parent, com.fasterxml.jackson.core.json.DupDetector dups, java.lang.Object currentValue)
-
-
Method Detail
-
reset
private SmileWriteContext reset(int type, java.lang.Object currentValue)
-
withDupDetector
public SmileWriteContext withDupDetector(com.fasterxml.jackson.core.json.DupDetector dups)
-
getCurrentValue
public java.lang.Object getCurrentValue()
- Overrides:
getCurrentValuein classcom.fasterxml.jackson.core.JsonStreamContext
-
setCurrentValue
public void setCurrentValue(java.lang.Object v)
- Overrides:
setCurrentValuein classcom.fasterxml.jackson.core.JsonStreamContext
-
createRootContext
public static SmileWriteContext createRootContext(com.fasterxml.jackson.core.json.DupDetector dd)
-
createChildArrayContext
public SmileWriteContext createChildArrayContext(java.lang.Object currentValue)
-
createChildObjectContext
public SmileWriteContext createChildObjectContext(java.lang.Object currentValue)
-
getParent
public final SmileWriteContext getParent()
- Specified by:
getParentin classcom.fasterxml.jackson.core.JsonStreamContext
-
getCurrentName
public final java.lang.String getCurrentName()
- Specified by:
getCurrentNamein classcom.fasterxml.jackson.core.JsonStreamContext
-
hasCurrentName
public boolean hasCurrentName()
- Overrides:
hasCurrentNamein classcom.fasterxml.jackson.core.JsonStreamContext
-
clearAndGetParent
public SmileWriteContext clearAndGetParent()
Method that can be used to both clear the accumulated references (specifically value set withsetCurrentValue(Object)) that should not be retained, and returns parent (as wouldgetParent()do). Typically called when closing the active context when encounteringJsonToken.END_ARRAYorJsonToken.END_OBJECT.
-
getDupDetector
public com.fasterxml.jackson.core.json.DupDetector getDupDetector()
-
writeFieldName
public boolean writeFieldName(java.lang.String name) throws com.fasterxml.jackson.core.JsonProcessingExceptionMethod that writer is to call before it writes a field name.- Returns:
- Ok if name writing should proceed
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
_checkDup
private final void _checkDup(com.fasterxml.jackson.core.json.DupDetector dd, java.lang.String name) throws com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
writeValue
public boolean writeValue()
-
-