Package com.fasterxml.jackson.jr.ob.impl
Class JSONWriter
- java.lang.Object
-
- com.fasterxml.jackson.jr.ob.impl.JSONWriter
-
public class JSONWriter extends java.lang.ObjectObject that handles serialization of simple Objects into underlying data format (usually JSON). UnlikeJSONReader, 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(int, com.fasterxml.jackson.core.JsonGenerator).
-
-
Field Summary
Fields Modifier and Type Field Description protected int_featuresprotected com.fasterxml.jackson.core.JsonGenerator_generatorprotected java.util.TimeZone_timezoneprotected com.fasterxml.jackson.core.TreeCodec_treeCodecprotected boolean_writeNullValuesprotected ValueWriterLocator_writerLocatorObject that is used to dynamically find Bean (and custom type) value writers
-
Constructor Summary
Constructors Modifier Constructor Description JSONWriter(int features, ValueWriterLocator td, com.fasterxml.jackson.core.TreeCodec tc)Constructor used for creating differently configured blueprint instancesprotectedJSONWriter(JSONWriter base, int features, ValueWriterLocator td, com.fasterxml.jackson.core.JsonGenerator g)Constructor for non-blueprint instances
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_checkUnknown(java.lang.Object value)protected JSONWriter_with(int features, ValueWriterLocator td, com.fasterxml.jackson.core.TreeCodec tc)Overridable method that all mutant factories call if a new instance is to be constructedprotected void_writeValue(java.lang.Object value, int type)protected java.lang.StringdateToString(java.util.Date v)protected java.lang.StringkeyToString(java.lang.Object rawKey)JSONWriterperOperationInstance(int features, com.fasterxml.jackson.core.JsonGenerator g)JSONWriterwith(com.fasterxml.jackson.core.TreeCodec tc)JSONWriterwith(ReaderWriterProvider rwp)JSONWriterwithCacheCheck(int features)voidwriteBeanValue(BeanPropertyWriter[] props, java.lang.Object bean)protected voidwriteBigDecimalField(java.lang.String fieldName, java.math.BigDecimal v)protected voidwriteBigDecimalValue(java.math.BigDecimal v)protected voidwriteBigIntegerField(java.lang.String fieldName, java.math.BigInteger v)protected voidwriteBigIntegerValue(java.math.BigInteger v)protected voidwriteBinaryField(java.lang.String fieldName, byte[] data)protected voidwriteBinaryValue(byte[] data)protected voidwriteBooleanArrayField(java.lang.String fieldName, boolean[] v)protected voidwriteBooleanArrayValue(boolean[] v)protected voidwriteBooleanField(java.lang.String fieldName, boolean v)protected voidwriteBooleanValue(boolean v)protected voidwriteCollectionField(java.lang.String fieldName, java.util.Collection<?> v)protected voidwriteCollectionValue(java.util.Collection<?> v)protected voidwriteDateField(java.lang.String fieldName, java.util.Date v)protected voidwriteDateValue(java.util.Date v)protected voidwriteDoubleField(java.lang.String fieldName, double v)protected voidwriteDoubleValue(double v)protected voidwriteEnumField(java.lang.String fieldName, java.lang.Enum<?> v)protected voidwriteEnumValue(java.lang.Enum<?> v)voidwriteField(java.lang.String fieldName, java.lang.Object value, int type)protected voidwriteIntArrayField(java.lang.String fieldName, int[] v)protected voidwriteIntArrayValue(int[] v)protected voidwriteIntField(java.lang.String fieldName, int v)protected voidwriteIntValue(int v)protected voidwriteIterableField(java.lang.String fieldName, java.lang.Iterable<?> v)protected voidwriteIterableValue(java.lang.Iterable<?> v)protected voidwriteListField(java.lang.String fieldName, java.util.List<?> v)protected voidwriteListValue(java.util.List<?> list)protected voidwriteLongArrayField(java.lang.String fieldName, long[] v)protected voidwriteLongArrayValue(long[] v)protected voidwriteLongField(java.lang.String fieldName, long v)protected voidwriteLongValue(long v)protected voidwriteMapField(java.lang.String fieldName, java.util.Map<?,?> v)protected voidwriteMapValue(java.util.Map<?,?> v)protected voidwriteNullField(com.fasterxml.jackson.core.io.SerializedString fieldName)protected voidwriteNullField(java.lang.String fieldName)protected voidwriteNullValue()protected voidwriteObjectArrayField(java.lang.String fieldName, java.lang.Object[] v)protected voidwriteObjectArrayValue(java.lang.Object[] v)protected voidwriteStringField(java.lang.String fieldName, java.lang.String v)protected voidwriteStringLikeField(java.lang.String fieldName, java.lang.String v, int actualType)protected voidwriteStringLikeValue(java.lang.String v, int actualType)protected voidwriteStringValue(java.lang.String v)protected voidwriteTreeNodeField(java.lang.String fieldName, com.fasterxml.jackson.core.TreeNode v)protected voidwriteTreeNodeValue(com.fasterxml.jackson.core.TreeNode v)protected voidwriteUnknownField(java.lang.String fieldName, java.lang.Object data)protected voidwriteUnknownValue(java.lang.Object data)voidwriteValue(java.lang.Object value)Main entry point for non-blueprint instances: called for the root value to write it out.
-
-
-
Field Detail
-
_features
protected final int _features
-
_writeNullValues
protected final boolean _writeNullValues
-
_writerLocator
protected final ValueWriterLocator _writerLocator
Object that is used to dynamically find Bean (and custom type) value writers
-
_treeCodec
protected final com.fasterxml.jackson.core.TreeCodec _treeCodec
-
_generator
protected final com.fasterxml.jackson.core.JsonGenerator _generator
-
_timezone
protected final java.util.TimeZone _timezone
-
-
Constructor Detail
-
JSONWriter
public JSONWriter(int features, ValueWriterLocator td, com.fasterxml.jackson.core.TreeCodec tc)Constructor used for creating differently configured blueprint instances
-
JSONWriter
protected JSONWriter(JSONWriter base, int features, ValueWriterLocator td, com.fasterxml.jackson.core.JsonGenerator g)
Constructor for non-blueprint instances
-
-
Method Detail
-
withCacheCheck
public JSONWriter withCacheCheck(int features)
-
with
public JSONWriter with(com.fasterxml.jackson.core.TreeCodec tc)
-
with
public JSONWriter with(ReaderWriterProvider rwp)
-
_with
protected JSONWriter _with(int features, ValueWriterLocator td, com.fasterxml.jackson.core.TreeCodec tc)
Overridable method that all mutant factories call if a new instance is to be constructed
-
perOperationInstance
public JSONWriter perOperationInstance(int features, com.fasterxml.jackson.core.JsonGenerator g)
-
writeValue
public void writeValue(java.lang.Object value) throws java.io.IOExceptionMain entry point for non-blueprint instances: called for the root value to write it out.- Throws:
java.io.IOException
-
writeField
public void writeField(java.lang.String fieldName, java.lang.Object value, int type) throws java.io.IOException- Throws:
java.io.IOException
-
_writeValue
protected void _writeValue(java.lang.Object value, int type) throws java.io.IOException- Throws:
java.io.IOException
-
writeCollectionValue
protected void writeCollectionValue(java.util.Collection<?> v) throws java.io.IOException- Throws:
java.io.IOException
-
writeCollectionField
protected void writeCollectionField(java.lang.String fieldName, java.util.Collection<?> v) throws java.io.IOException- Throws:
java.io.IOException
-
writeIterableValue
protected void writeIterableValue(java.lang.Iterable<?> v) throws java.io.IOException- Throws:
java.io.IOException
-
writeIterableField
protected void writeIterableField(java.lang.String fieldName, java.lang.Iterable<?> v) throws java.io.IOException- Throws:
java.io.IOException
-
writeListValue
protected void writeListValue(java.util.List<?> list) throws java.io.IOException- Throws:
java.io.IOException
-
writeListField
protected void writeListField(java.lang.String fieldName, java.util.List<?> v) throws java.io.IOException- Throws:
java.io.IOException
-
writeMapValue
protected void writeMapValue(java.util.Map<?,?> v) throws java.io.IOException- Throws:
java.io.IOException
-
writeMapField
protected void writeMapField(java.lang.String fieldName, java.util.Map<?,?> v) throws java.io.IOException- Throws:
java.io.IOException
-
writeObjectArrayValue
protected void writeObjectArrayValue(java.lang.Object[] v) throws java.io.IOException- Throws:
java.io.IOException
-
writeObjectArrayField
protected void writeObjectArrayField(java.lang.String fieldName, java.lang.Object[] v) throws java.io.IOException- Throws:
java.io.IOException
-
writeIntArrayValue
protected void writeIntArrayValue(int[] v) throws java.io.IOException- Throws:
java.io.IOException
-
writeIntArrayField
protected void writeIntArrayField(java.lang.String fieldName, int[] v) throws java.io.IOException- Throws:
java.io.IOException
-
writeLongArrayValue
protected void writeLongArrayValue(long[] v) throws java.io.IOException- Throws:
java.io.IOException
-
writeLongArrayField
protected void writeLongArrayField(java.lang.String fieldName, long[] v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBooleanArrayValue
protected void writeBooleanArrayValue(boolean[] v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBooleanArrayField
protected void writeBooleanArrayField(java.lang.String fieldName, boolean[] v) throws java.io.IOException- Throws:
java.io.IOException
-
writeTreeNodeValue
protected void writeTreeNodeValue(com.fasterxml.jackson.core.TreeNode v) throws java.io.IOException- Throws:
java.io.IOException
-
writeTreeNodeField
protected void writeTreeNodeField(java.lang.String fieldName, com.fasterxml.jackson.core.TreeNode v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBooleanValue
protected void writeBooleanValue(boolean v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBooleanField
protected void writeBooleanField(java.lang.String fieldName, boolean v) throws java.io.IOException- Throws:
java.io.IOException
-
writeIntValue
protected void writeIntValue(int v) throws java.io.IOException- Throws:
java.io.IOException
-
writeIntField
protected void writeIntField(java.lang.String fieldName, int v) throws java.io.IOException- Throws:
java.io.IOException
-
writeLongValue
protected void writeLongValue(long v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBigIntegerValue
protected void writeBigIntegerValue(java.math.BigInteger v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBigIntegerField
protected void writeBigIntegerField(java.lang.String fieldName, java.math.BigInteger v) throws java.io.IOException- Throws:
java.io.IOException
-
writeLongField
protected void writeLongField(java.lang.String fieldName, long v) throws java.io.IOException- Throws:
java.io.IOException
-
writeDoubleValue
protected void writeDoubleValue(double v) throws java.io.IOException- Throws:
java.io.IOException
-
writeDoubleField
protected void writeDoubleField(java.lang.String fieldName, double v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBigDecimalValue
protected void writeBigDecimalValue(java.math.BigDecimal v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBigDecimalField
protected void writeBigDecimalField(java.lang.String fieldName, java.math.BigDecimal v) throws java.io.IOException- Throws:
java.io.IOException
-
writeStringValue
protected void writeStringValue(java.lang.String v) throws java.io.IOException- Throws:
java.io.IOException
-
writeStringField
protected void writeStringField(java.lang.String fieldName, java.lang.String v) throws java.io.IOException- Throws:
java.io.IOException
-
writeStringLikeValue
protected void writeStringLikeValue(java.lang.String v, int actualType) throws java.io.IOException- Throws:
java.io.IOException
-
writeStringLikeField
protected void writeStringLikeField(java.lang.String fieldName, java.lang.String v, int actualType) throws java.io.IOException- Throws:
java.io.IOException
-
writeBinaryValue
protected void writeBinaryValue(byte[] data) throws java.io.IOException- Throws:
java.io.IOException
-
writeBinaryField
protected void writeBinaryField(java.lang.String fieldName, byte[] data) throws java.io.IOException- Throws:
java.io.IOException
-
writeNullValue
protected void writeNullValue() throws java.io.IOException- Throws:
java.io.IOException
-
writeNullField
protected void writeNullField(java.lang.String fieldName) throws java.io.IOException- Throws:
java.io.IOException
-
writeNullField
protected void writeNullField(com.fasterxml.jackson.core.io.SerializedString fieldName) throws java.io.IOException- Throws:
java.io.IOException
-
writeDateValue
protected void writeDateValue(java.util.Date v) throws java.io.IOException- Throws:
java.io.IOException
-
writeDateField
protected void writeDateField(java.lang.String fieldName, java.util.Date v) throws java.io.IOException- Throws:
java.io.IOException
-
writeEnumValue
protected void writeEnumValue(java.lang.Enum<?> v) throws java.io.IOException- Throws:
java.io.IOException
-
writeEnumField
protected void writeEnumField(java.lang.String fieldName, java.lang.Enum<?> v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBeanValue
public void writeBeanValue(BeanPropertyWriter[] props, java.lang.Object bean) throws java.io.IOException
- Throws:
java.io.IOException
-
writeUnknownValue
protected void writeUnknownValue(java.lang.Object data) throws java.io.IOException- Throws:
java.io.IOException
-
writeUnknownField
protected void writeUnknownField(java.lang.String fieldName, java.lang.Object data) throws java.io.IOException- Throws:
java.io.IOException
-
_checkUnknown
protected void _checkUnknown(java.lang.Object value) throws java.io.IOException- Throws:
java.io.IOException
-
keyToString
protected java.lang.String keyToString(java.lang.Object rawKey)
-
dateToString
protected java.lang.String dateToString(java.util.Date v)
- Since:
- 2.7
-
-