Class JsonRecordPipelineOutput

All Implemented Interfaces:
DataExceptionContributor, JsonSerializable, RecordSerializable, XmlSerializable, DataWriterFactory, JavaCodeGenerator, Serializable

public class JsonRecordPipelineOutput extends FileSinkPipelineOutput
Writes a pipeline's records to a JSON FileSink using a JsonRecordWriter, one object per record.
See Also:
  • Constructor Details

    • JsonRecordPipelineOutput

      public JsonRecordPipelineOutput()
  • Method Details

    • createDataWriter

      public DataWriter createDataWriter()
    • getFileSink

      public FileSink getFileSink()
      Specified by:
      getFileSink in class FileSinkPipelineOutput
    • setFileSink

      public JsonRecordPipelineOutput setFileSink(FileSink fileSink)
      Specified by:
      setFileSink in class FileSinkPipelineOutput
    • getName

      public String getName()
      Description copied from class: PipelineOutput
      Returns a display name for this output, such as the destination's name followed by its format.
      Overrides:
      getName in class FileSinkPipelineOutput
    • getRootFieldName

      public String getRootFieldName()
      Returns the name of the top-level field holding the records array or blank to write a bare array (defaults to data).
    • setRootFieldName

      public JsonRecordPipelineOutput setRootFieldName(String rootFieldName)
      Sets the name of the top-level field holding the records array or blank to write a bare array (defaults to data).
    • isPretty

      public boolean isPretty()
      Indicates if line breaks and indentation are added to the output (defaults to false).
    • setPretty

      public JsonRecordPipelineOutput setPretty(boolean pretty)
      Indicates if line breaks and indentation are added to the output (defaults to false).
    • getCharset

      public String getCharset()
      Returns the character set used to write the file (defaults to UTF-8); blank uses the platform default.
    • setCharset

      public JsonRecordPipelineOutput setCharset(String charset)
      Sets the character set used to write the file (defaults to UTF-8); blank uses the platform default.
    • isAutoCloseWriter

      public boolean isAutoCloseWriter()
      Indicates if the file's stream is closed when the writer is closed (defaults to true).
    • setAutoCloseWriter

      public JsonRecordPipelineOutput setAutoCloseWriter(boolean autoCloseWriter)
      Indicates if the file's stream is closed when the writer is closed (defaults to true).
    • isFlushOnWrite

      public boolean isFlushOnWrite()
      Indicates if the output is flushed after each record (defaults to false).
    • setFlushOnWrite

      public JsonRecordPipelineOutput setFlushOnWrite(boolean flushOnWrite)
      Indicates if the output is flushed after each record (defaults to false).
    • generateSaveCode

      public void generateSaveCode(JavaCodeBuilder javaCodeBuilder)
      Description copied from class: FileSinkPipelineOutput
      Writes the generated code that saves the output after Job.run(reader, writer); does nothing by default.
      Overrides:
      generateSaveCode in class FileSinkPipelineOutput
    • generateJavaCode

      public void generateJavaCode(JavaCodeBuilder code)
      Description copied from interface: JavaCodeGenerator
      Appends Java source code representing this object to the given builder.
    • toRecord

      public Record toRecord()
      Description copied from interface: RecordSerializable
      Converts this object's state to a record that RecordSerializable.fromRecord(Record) can load.
      Specified by:
      toRecord in interface RecordSerializable
      Overrides:
      toRecord in class Bean
    • fromRecord

      public JsonRecordPipelineOutput fromRecord(Record source)
      Description copied from interface: RecordSerializable
      Loads this instance's state from a record and returns this (for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.
      Specified by:
      fromRecord in interface RecordSerializable
      Overrides:
      fromRecord in class PipelineOutput
      Parameters:
      source -
      Returns:
      this instance.
    • toXmlElement

      public Element toXmlElement(Document document)
      Description copied from interface: XmlSerializable
      Returns an element, created with document, describing this object; the default implementation throws a DataException.
      Specified by:
      toXmlElement in interface XmlSerializable
      Overrides:
      toXmlElement in class PipelineOutput
    • fromXmlElement

      public JsonRecordPipelineOutput fromXmlElement(Element pipelineInputElement)