Top Description Fields Constructors Methods
tools.jackson.jr.ob.impl

public Class JSONWriter

extends Object
Class Inheritance
Static Imports
tools.jackson.jr.ob.impl.ValueWriterLocator.*

Object that handles serialization of simple Objects into underlying data format (usually JSON). Unlike JSONReader, writer does actually implement write methods itself and uses delegation for only some special cases.

Life-cycle is such that initial instance (called blueprint) is constructed first (including possible configuration using mutant factory methods). This blueprint object acts as a factory, and is never used for direct writing; instead, per-call instance is created by calling perOperationInstance.

Field Summary

Modifier and TypeField and Description
protected final int
protected final JsonGenerator
protected final TimeZone
protected final TreeCodec
protected final boolean
protected final ValueWriterLocator
_writerLocator

Object that is used to dynamically find Bean (and custom type) value writers

private static final TimeZone

Constructor Summary

AccessConstructor and Description
public
JSONWriter()

Constructor used for creating differently configured blueprint instances

protected
JSONWriter(JSONWriter
Blueprint instance to base settings of the new instance on
base
,
int
Active features for the write operation
features
,
ValueWriterLocator
Helper object to use for dynamically located value writers
loc
,
TreeCodec
TreeCodec to use for writing tree values, if any
tc
,
JsonGenerator
Underlying streaming encoder to use
g
)

Constructor for non-blueprint instances.

Method Summary

Modifier and TypeMethod and Description
private void
_badType(int type, Object value)

protected void
protected void
_writeValue(Object value, int type)

protected String
public int
public boolean
protected String
protected String
public JSONWriter
public JSONWriter
withCacheCheck(int features)

public void
protected void
protected void
protected void
protected void
protected void
writeBinaryProperty(String propName, byte[] data)

protected void
writeBinaryValue(byte[] data)

protected void
writeBooleanArrayProperty(String propName, boolean[] v)

protected void
protected void
writeBooleanProperty(String propName, boolean v)

protected void
writeBooleanValue(boolean v)

protected void
protected void
protected void
protected void
protected void
writeDoubleArrayField(String fieldName, double[] v)

protected void
protected void
writeDoubleProperty(String propName, double v)

protected void
writeDoubleValue(double v)

protected void
writeEnumProperty(String propName, Enum<?> v)

protected void
protected void
writeFloatArrayField(String fieldName, float[] v)

protected void
protected void
writeFloatProperty(String fieldName, float v)

protected void
writeFloatValue(float v)

protected void
writeIntArrayProperty(String propName, int[] v)

protected void
protected void
writeIntProperty(String propName, int v)

protected void
protected void
protected void
protected void
writeListProperty(String propName, List<?> v)

protected void
protected void
writeLongArrayProperty(String propName, long[] v)

protected void
protected void
writeLongProperty(String propName, long v)

protected void
protected void
writeMapProperty(String propName, Map<?, ?> v)

protected void
writeMapValue(Map<?, ?> v)

protected void
protected void
protected void
protected void
protected void
public void
writeProperty(String propName, Object value, int type)

protected void
writeShortArrayField(String fieldName, short[] v)

protected void
protected void
writeStringLikeProperty(String propName, String v, int actualType)

protected void
writeStringLikeValue(String v, int actualType)

protected void
protected void
protected void
protected void
protected void
protected void
public void
writeValue(Object value)

Main entry point for non-blueprint instances: called for the root value to write it out.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_featuresback to summary
protected final int _features
_generatorback to summary
protected final JsonGenerator _generator
_timezoneback to summary
protected final TimeZone _timezone
_treeCodecback to summary
protected final TreeCodec _treeCodec
_writeNullValuesback to summary
protected final boolean _writeNullValues
_writerLocatorback to summary
protected final ValueWriterLocator _writerLocator

Object that is used to dynamically find Bean (and custom type) value writers

DEFAULT_TIMEZONEback to summary
private static final TimeZone DEFAULT_TIMEZONE

Constructor Detail

JSONWriterback to summary
public JSONWriter()

Constructor used for creating differently configured blueprint instances

JSONWriterback to summary
protected JSONWriter(JSONWriter base, int features, ValueWriterLocator loc, TreeCodec tc, JsonGenerator g)

Constructor for non-blueprint instances.

Parameters
base:JSONWriter

Blueprint instance to base settings of the new instance on

features:int

Active features for the write operation

loc:ValueWriterLocator

Helper object to use for dynamically located value writers

tc:TreeCodec

TreeCodec to use for writing tree values, if any

g:JsonGenerator

Underlying streaming encoder to use

Method Detail

_badTypeback to summary
private void _badType(int type, Object value)
_checkUnknownback to summary
protected void _checkUnknown(Object value) throws JacksonException
_writeValueback to summary
protected void _writeValue(Object value, int type) throws JacksonException
dateToStringback to summary
protected String dateToString(Date v)
featuresback to summary
public int features()
Since
2.13
isEnabledback to summary
public boolean isEnabled(JSON.Feature f)
keyToStringback to summary
protected String keyToString(Object rawKey)
pathToStringback to summary
protected String pathToString(Path value)
Since
2.17
perOperationInstanceback to summary
public JSONWriter perOperationInstance(int features, ValueWriterLocator loc, TreeCodec tc, JsonGenerator g)
withCacheCheckback to summary
public JSONWriter withCacheCheck(int features)
writeBeanValueback to summary
public void writeBeanValue(BeanPropertyWriter[] props, Object bean) throws JacksonException
writeBigDecimalPropertyback to summary
protected void writeBigDecimalProperty(String propName, BigDecimal v) throws JacksonException
writeBigDecimalValueback to summary
protected void writeBigDecimalValue(BigDecimal v) throws JacksonException
writeBigIntegerPropertyback to summary
protected void writeBigIntegerProperty(String propName, BigInteger v) throws JacksonException
writeBigIntegerValueback to summary
protected void writeBigIntegerValue(BigInteger v) throws JacksonException
writeBinaryPropertyback to summary
protected void writeBinaryProperty(String propName, byte[] data) throws JacksonException
writeBinaryValueback to summary
protected void writeBinaryValue(byte[] data) throws JacksonException
writeBooleanArrayPropertyback to summary
protected void writeBooleanArrayProperty(String propName, boolean[] v) throws JacksonException
writeBooleanArrayValueback to summary
protected void writeBooleanArrayValue(boolean[] v) throws JacksonException
writeBooleanPropertyback to summary
protected void writeBooleanProperty(String propName, boolean v) throws JacksonException
writeBooleanValueback to summary
protected void writeBooleanValue(boolean v) throws JacksonException
writeCollectionPropertyback to summary
protected void writeCollectionProperty(String propName, Collection<?> v) throws JacksonException
writeCollectionValueback to summary
protected void writeCollectionValue(Collection<?> v) throws JacksonException
writeDatePropertyback to summary
protected void writeDateProperty(String propName, Date v) throws JacksonException
writeDateValueback to summary
protected void writeDateValue(Date v) throws JacksonException
writeDoubleArrayFieldback to summary
protected void writeDoubleArrayField(String fieldName, double[] v) throws JacksonException
writeDoubleArrayValueback to summary
protected void writeDoubleArrayValue(double[] v) throws JacksonException
writeDoublePropertyback to summary
protected void writeDoubleProperty(String propName, double v) throws JacksonException
writeDoubleValueback to summary
protected void writeDoubleValue(double v) throws JacksonException
writeEnumPropertyback to summary
protected void writeEnumProperty(String propName, Enum<?> v) throws JacksonException
writeEnumValueback to summary
protected void writeEnumValue(Enum<?> v) throws JacksonException
writeFloatArrayFieldback to summary
protected void writeFloatArrayField(String fieldName, float[] v) throws JacksonException
writeFloatArrayValueback to summary
protected void writeFloatArrayValue(float[] v) throws JacksonException
writeFloatPropertyback to summary
protected void writeFloatProperty(String fieldName, float v) throws JacksonException
writeFloatValueback to summary
protected void writeFloatValue(float v) throws JacksonException
writeIntArrayPropertyback to summary
protected void writeIntArrayProperty(String propName, int[] v) throws JacksonException
writeIntArrayValueback to summary
protected void writeIntArrayValue(int[] v) throws JacksonException
writeIntPropertyback to summary
protected void writeIntProperty(String propName, int v) throws JacksonException
writeIntValueback to summary
protected void writeIntValue(int v) throws JacksonException
writeIterablePropertyback to summary
protected void writeIterableProperty(String propName, Iterable<?> v) throws JacksonException
writeIterableValueback to summary
protected void writeIterableValue(Iterable<?> v) throws JacksonException
writeListPropertyback to summary
protected void writeListProperty(String propName, List<?> v) throws JacksonException
writeListValueback to summary
protected void writeListValue(List<?> list) throws JacksonException
writeLongArrayPropertyback to summary
protected void writeLongArrayProperty(String propName, long[] v) throws JacksonException
writeLongArrayValueback to summary
protected void writeLongArrayValue(long[] v) throws JacksonException
writeLongPropertyback to summary
protected void writeLongProperty(String propName, long v) throws JacksonException
writeLongValueback to summary
protected void writeLongValue(long v) throws JacksonException
writeMapPropertyback to summary
protected void writeMapProperty(String propName, Map<?, ?> v) throws JacksonException
writeMapValueback to summary
protected void writeMapValue(Map<?, ?> v) throws JacksonException
writeNullPropertyback to summary
protected void writeNullProperty(String propName) throws JacksonException
writeNullPropertyback to summary
protected void writeNullProperty(SerializedString propName) throws JacksonException
writeNullValueback to summary
protected void writeNullValue() throws JacksonException
writeObjectArrayPropertyback to summary
protected void writeObjectArrayProperty(String propName, Object[] v) throws JacksonException
writeObjectArrayValueback to summary
protected void writeObjectArrayValue(Object[] v) throws JacksonException
writePropertyback to summary
public void writeProperty(String propName, Object value, int type) throws JacksonException
writeShortArrayFieldback to summary
protected void writeShortArrayField(String fieldName, short[] v) throws JacksonException
writeShortArrayValueback to summary
protected void writeShortArrayValue(short[] v) throws JacksonException
writeStringLikePropertyback to summary
protected void writeStringLikeProperty(String propName, String v, int actualType) throws JacksonException
writeStringLikeValueback to summary
protected void writeStringLikeValue(String v, int actualType) throws JacksonException
writeStringPropertyback to summary
protected void writeStringProperty(String propName, String v) throws JacksonException
writeStringValueback to summary
protected void writeStringValue(String v) throws JacksonException
writeTreeNodePropertyback to summary
protected void writeTreeNodeProperty(String propName, TreeNode v) throws JacksonException
writeTreeNodeValueback to summary
protected void writeTreeNodeValue(TreeNode v) throws JacksonException
writeUnknownPropertyback to summary
protected void writeUnknownProperty(String propName, Object data) throws JacksonException
writeUnknownValueback to summary
protected void writeUnknownValue(Object data) throws JacksonException
writeValueback to summary
public void writeValue(Object value) throws JacksonException

Main entry point for non-blueprint instances: called for the root value to write it out.