public class JSONWriter extends Object
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(com.fasterxml.jackson.core.JsonGenerator)
.
Modifier and Type | Field and Description |
---|---|
protected int |
_features |
protected JsonGenerator |
_generator |
protected boolean |
_requireSetter |
protected TreeCodec |
_treeCodec |
protected TypeDetector |
_typeDetector
Object that is used to resolve types of values dynamically.
|
Modifier | Constructor and Description |
---|---|
|
JSONWriter(int features,
TypeDetector td,
TreeCodec tc)
Constructor used for creating differently configured blueprint
instances
|
protected |
JSONWriter(JSONWriter base,
JsonGenerator jgen)
Constructor for non-blueprint instances
|
Modifier and Type | Method and Description |
---|---|
protected void |
_checkUnknown(Object value) |
protected JSONWriter |
_with(int features,
TypeDetector td,
TreeCodec tc)
Overridable method that all mutant factories call if a new instance
is to be constructed
|
protected void |
_writeValue(Object value,
int type) |
protected String |
keyToString(Object rawKey) |
JSONWriter |
perOperationInstance(JsonGenerator jg) |
JSONWriter |
with(TreeCodec tc) |
JSONWriter |
with(TypeDetector td) |
JSONWriter |
withFeatures(int features) |
protected void |
writeBeanValue(BeanDefinition beanDef,
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) |
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<?> v) |
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(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,
TreeNode v) |
protected void |
writeTreeNodeValue(TreeNode v) |
protected void |
writeUnknownField(String fieldName,
Object data) |
protected void |
writeUnknownValue(Object data) |
void |
writeValue(Object value) |
protected final int _features
protected final TypeDetector _typeDetector
protected final TreeCodec _treeCodec
protected final boolean _requireSetter
protected final JsonGenerator _generator
public JSONWriter(int features, TypeDetector td, TreeCodec tc)
protected JSONWriter(JSONWriter base, JsonGenerator jgen)
public final JSONWriter withFeatures(int features)
public final JSONWriter with(TypeDetector td)
public final JSONWriter with(TreeCodec tc)
protected JSONWriter _with(int features, TypeDetector td, TreeCodec tc)
public JSONWriter perOperationInstance(JsonGenerator jg)
public final void writeValue(Object value) throws IOException, JsonProcessingException
IOException
JsonProcessingException
public void writeField(String fieldName, Object value) throws IOException, JsonProcessingException
IOException
JsonProcessingException
protected void _writeValue(Object value, int type) throws IOException
IOException
protected void writeCollectionValue(Collection<?> v) throws IOException
IOException
protected void writeCollectionField(String fieldName, Collection<?> v) throws IOException
IOException
protected void writeIterableValue(Iterable<?> v) throws IOException
IOException
protected void writeIterableField(String fieldName, Iterable<?> v) throws IOException
IOException
protected void writeListValue(List<?> v) throws IOException
IOException
protected void writeListField(String fieldName, List<?> v) throws IOException
IOException
protected void writeMapValue(Map<?,?> v) throws IOException
IOException
protected void writeMapField(String fieldName, Map<?,?> v) throws IOException
IOException
protected void writeObjectArrayValue(Object[] v) throws IOException
IOException
protected void writeObjectArrayField(String fieldName, Object[] v) throws IOException
IOException
protected void writeIntArrayValue(int[] v) throws IOException
IOException
protected void writeIntArrayField(String fieldName, int[] v) throws IOException
IOException
protected void writeLongArrayValue(long[] v) throws IOException
IOException
protected void writeLongArrayField(String fieldName, long[] v) throws IOException
IOException
protected void writeBooleanArrayValue(boolean[] v) throws IOException
IOException
protected void writeBooleanArrayField(String fieldName, boolean[] v) throws IOException
IOException
protected void writeTreeNodeValue(TreeNode v) throws IOException
IOException
protected void writeTreeNodeField(String fieldName, TreeNode v) throws IOException
IOException
protected void writeBooleanValue(boolean v) throws IOException
IOException
protected void writeBooleanField(String fieldName, boolean v) throws IOException
IOException
protected void writeIntValue(int v) throws IOException
IOException
protected void writeIntField(String fieldName, int v) throws IOException
IOException
protected void writeLongValue(long v) throws IOException
IOException
protected void writeBigIntegerValue(BigInteger v) throws IOException
IOException
protected void writeBigIntegerField(String fieldName, BigInteger v) throws IOException
IOException
protected void writeLongField(String fieldName, long v) throws IOException
IOException
protected void writeDoubleValue(double v) throws IOException
IOException
protected void writeDoubleField(String fieldName, double v) throws IOException
IOException
protected void writeBigDecimalValue(BigDecimal v) throws IOException
IOException
protected void writeBigDecimalField(String fieldName, BigDecimal v) throws IOException
IOException
protected void writeStringValue(String v) throws IOException
IOException
protected void writeStringField(String fieldName, String v) throws IOException
IOException
protected void writeStringLikeValue(String v, int actualType) throws IOException
IOException
protected void writeStringLikeField(String fieldName, String v, int actualType) throws IOException
IOException
protected void writeBinaryValue(byte[] data) throws IOException
IOException
protected void writeBinaryField(String fieldName, byte[] data) throws IOException
IOException
protected void writeNullValue() throws IOException
IOException
protected void writeNullField(String fieldName) throws IOException
IOException
protected void writeNullField(SerializedString fieldName) throws IOException
IOException
protected void writeDateValue(Date v) throws IOException
IOException
protected void writeDateField(String fieldName, Date v) throws IOException
IOException
protected void writeEnumValue(Enum<?> v) throws IOException
IOException
protected void writeEnumField(String fieldName, Enum<?> v) throws IOException
IOException
protected void writeBeanValue(BeanDefinition beanDef, Object bean) throws IOException
IOException
protected void writeUnknownValue(Object data) throws IOException
IOException
protected void writeUnknownField(String fieldName, Object data) throws IOException
IOException
protected void _checkUnknown(Object value) throws IOException
IOException
Copyright © 2014-2015 FasterXML. All Rights Reserved.