com.fasterxml.jackson.jr.ob.impl
Class JSONWriter

java.lang.Object
  extended by 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(com.fasterxml.jackson.core.JsonGenerator).


Field Summary
protected  int _features
           
protected  JsonGenerator _generator
           
protected  boolean _requireSetter
           
protected  TimeZone _timezone
           
protected  TreeCodec _treeCodec
           
protected  TypeDetector _typeDetector
          Object that is used to resolve types of values dynamically.
 
Constructor Summary
  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
 
Method Summary
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 dateToString(Date v)
           
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_features

protected final int _features

_typeDetector

protected final TypeDetector _typeDetector
Object that is used to resolve types of values dynamically.


_treeCodec

protected final TreeCodec _treeCodec

_requireSetter

protected final boolean _requireSetter

_generator

protected final JsonGenerator _generator

_timezone

protected final TimeZone _timezone
Constructor Detail

JSONWriter

public JSONWriter(int features,
                  TypeDetector td,
                  TreeCodec tc)
Constructor used for creating differently configured blueprint instances


JSONWriter

protected JSONWriter(JSONWriter base,
                     JsonGenerator jgen)
Constructor for non-blueprint instances

Method Detail

withFeatures

public JSONWriter withFeatures(int features)

with

public JSONWriter with(TypeDetector td)

with

public JSONWriter with(TreeCodec tc)

_with

protected JSONWriter _with(int features,
                           TypeDetector td,
                           TreeCodec tc)
Overridable method that all mutant factories call if a new instance is to be constructed


perOperationInstance

public JSONWriter perOperationInstance(JsonGenerator jg)

writeValue

public void writeValue(Object value)
                throws IOException,
                       JsonProcessingException
Throws:
IOException
JsonProcessingException

writeField

public void writeField(String fieldName,
                       Object value)
                throws IOException,
                       JsonProcessingException
Throws:
IOException
JsonProcessingException

_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<?> v)
                       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(TreeNode v)
                           throws IOException
Throws:
IOException

writeTreeNodeField

protected void writeTreeNodeField(String fieldName,
                                  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(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(BeanDefinition beanDef,
                              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

keyToString

protected String keyToString(Object rawKey)

dateToString

protected String dateToString(Date v)
Since:
2.7


Copyright © 2016 FasterXML. All rights reserved.