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