com.fasterxml.jackson.jr.ob
Class JSONComposer<T>
java.lang.Object
com.fasterxml.jackson.jr.ob.comp.ComposerBase
com.fasterxml.jackson.jr.ob.comp.SequenceComposer<JSONComposer<T>>
com.fasterxml.jackson.jr.ob.JSONComposer<T>
- Type Parameters:
T
- Type of result being composed.
- All Implemented Interfaces:
- Flushable
public class JSONComposer<T>
- extends SequenceComposer<JSONComposer<T>>
Root-level composer object that acts as streaming "builder"
object, using an underlying JsonGenerator
object.
This is similar to ArrayComposer
, but does not
have parent composer (so no end()
method),
but does implement Closeable
Method Summary |
protected Object |
_finish()
|
protected JSONComposer<T> |
_start()
|
static JSONComposer<byte[]> |
bytesComposer(int features,
JsonGenerator gen,
ByteArrayBuilder w)
|
static
|
collectionComposer(int features,
T coll)
|
T |
finish()
Method to call to complete composition, flush any pending content,
and return instance of specified result type. |
static JSONComposer<Map<String,Object>> |
mapComposer(int features,
Map<String,Object> map)
|
static
|
streamComposer(int features,
JsonGenerator gen,
boolean closeGenerator)
|
static JSONComposer<String> |
stringComposer(int features,
JsonGenerator gen,
SegmentedStringWriter w)
|
Methods inherited from class com.fasterxml.jackson.jr.ob.comp.SequenceComposer |
_closeChild, _this, add, add, add, add, add, add, addNull, addObject, flush, startArray, startObject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_features
protected final int _features
_closeGenerator
protected final boolean _closeGenerator
_result
protected T _result
_stringWriter
protected SegmentedStringWriter _stringWriter
_byteWriter
protected ByteArrayBuilder _byteWriter
JSONComposer
public JSONComposer(int features,
JsonGenerator gen,
boolean closeGenerator)
JSONComposer
protected JSONComposer(int features,
JsonGenerator gen,
SegmentedStringWriter w)
JSONComposer
protected JSONComposer(int features,
JsonGenerator gen,
ByteArrayBuilder w)
JSONComposer
protected JSONComposer(int features,
T result)
streamComposer
public static <RESULT> JSONComposer<RESULT> streamComposer(int features,
JsonGenerator gen,
boolean closeGenerator)
stringComposer
public static JSONComposer<String> stringComposer(int features,
JsonGenerator gen,
SegmentedStringWriter w)
bytesComposer
public static JSONComposer<byte[]> bytesComposer(int features,
JsonGenerator gen,
ByteArrayBuilder w)
collectionComposer
public static <T extends Collection<Object>> JSONComposer<T> collectionComposer(int features,
T coll)
mapComposer
public static JSONComposer<Map<String,Object>> mapComposer(int features,
Map<String,Object> map)
finish
public T finish()
throws IOException,
JsonProcessingException
- Method to call to complete composition, flush any pending content,
and return instance of specified result type.
- Throws:
IOException
JsonProcessingException
_start
protected JSONComposer<T> _start()
throws IOException,
JsonProcessingException
- Specified by:
_start
in class ComposerBase
- Throws:
IOException
JsonProcessingException
_finish
protected Object _finish()
throws IOException,
JsonProcessingException
- Specified by:
_finish
in class ComposerBase
- Throws:
IOException
JsonProcessingException
Copyright © 2016 FasterXML. All rights reserved.