Class 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
  • Field Details

    • _features

      protected final int _features
    • _closeGenerator

      protected final boolean _closeGenerator
    • _result

      protected T _result
    • _stringWriter

      protected com.fasterxml.jackson.core.io.SegmentedStringWriter _stringWriter
    • _byteWriter

      protected com.fasterxml.jackson.core.util.ByteArrayBuilder _byteWriter
  • Constructor Details

    • JSONComposer

      public JSONComposer(int features, com.fasterxml.jackson.core.JsonGenerator gen, boolean closeGenerator)
    • JSONComposer

      protected JSONComposer(int features, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.core.io.SegmentedStringWriter w)
    • JSONComposer

      protected JSONComposer(int features, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.core.util.ByteArrayBuilder w)
    • JSONComposer

      protected JSONComposer(int features, T result)
  • Method Details

    • streamComposer

      public static <RESULT> JSONComposer<RESULT> streamComposer(int features, com.fasterxml.jackson.core.JsonGenerator gen, boolean closeGenerator)
    • stringComposer

      public static JSONComposer<String> stringComposer(int features, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.core.io.SegmentedStringWriter w)
    • bytesComposer

      public static JSONComposer<byte[]> bytesComposer(int features, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.core.util.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
      Method to call to complete composition, flush any pending content, and return instance of specified result type.
      Throws:
      IOException
    • _start

      protected JSONComposer<T> _start() throws IOException
      Specified by:
      _start in class ComposerBase
      Throws:
      IOException
    • _finish

      protected Object _finish() throws IOException
      Specified by:
      _finish in class ComposerBase
      Throws:
      IOException