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
_features
protected com.fasterxml.jackson.core.JsonGenerator
_generator
protected TimeZone
_timezone
protected com.fasterxml.jackson.core.TreeCodec
_treeCodec
protected TypeDetector
_typeDetector
Object 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 instancesprotected
JSONWriter(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 String
dateToString(Date v)
protected String
keyToString(Object rawKey)
JSONWriter
perOperationInstance(int features, com.fasterxml.jackson.core.JsonGenerator g)
JSONWriter
with(com.fasterxml.jackson.core.TreeCodec tc)
protected void
writeBeanValue(BeanPropertyWriter[] props, Object bean)
protected void
writeBigDecimalField(String fieldName, BigDecimal v)
protected void
writeBigDecimalValue(BigDecimal v)
protected void
writeBigIntegerField(String fieldName, BigInteger v)
protected void
writeBigIntegerValue(BigInteger v)
protected void
writeBinaryField(String fieldName, byte[] data)
protected void
writeBinaryValue(byte[] data)
protected void
writeBooleanArrayField(String fieldName, boolean[] v)
protected void
writeBooleanArrayValue(boolean[] v)
protected void
writeBooleanField(String fieldName, boolean v)
protected void
writeBooleanValue(boolean v)
protected void
writeCollectionField(String fieldName, Collection<?> v)
protected void
writeCollectionValue(Collection<?> v)
protected void
writeDateField(String fieldName, Date v)
protected void
writeDateValue(Date v)
protected void
writeDoubleField(String fieldName, double v)
protected void
writeDoubleValue(double v)
protected void
writeEnumField(String fieldName, Enum<?> v)
protected void
writeEnumValue(Enum<?> v)
void
writeField(String fieldName, Object value)
Deprecated.void
writeField(String fieldName, Object value, int type)
protected void
writeIntArrayField(String fieldName, int[] v)
protected void
writeIntArrayValue(int[] v)
protected void
writeIntField(String fieldName, int v)
protected void
writeIntValue(int v)
protected void
writeIterableField(String fieldName, Iterable<?> v)
protected void
writeIterableValue(Iterable<?> v)
protected void
writeListField(String fieldName, List<?> v)
protected void
writeListValue(List<?> list)
protected void
writeLongArrayField(String fieldName, long[] v)
protected void
writeLongArrayValue(long[] v)
protected void
writeLongField(String fieldName, long v)
protected void
writeLongValue(long v)
protected void
writeMapField(String fieldName, Map<?,?> v)
protected void
writeMapValue(Map<?,?> v)
protected void
writeNullField(com.fasterxml.jackson.core.io.SerializedString fieldName)
protected void
writeNullField(String fieldName)
protected void
writeNullValue()
protected void
writeObjectArrayField(String fieldName, Object[] v)
protected void
writeObjectArrayValue(Object[] v)
protected void
writeStringField(String fieldName, String v)
protected void
writeStringLikeField(String fieldName, String v, int actualType)
protected void
writeStringLikeValue(String v, int actualType)
protected void
writeStringValue(String v)
protected void
writeTreeNodeField(String fieldName, com.fasterxml.jackson.core.TreeNode v)
protected void
writeTreeNodeValue(com.fasterxml.jackson.core.TreeNode v)
protected void
writeUnknownField(String fieldName, Object data)
protected void
writeUnknownValue(Object data)
void
writeValue(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
-
-