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

public class CsvPipelineInput extends FileSourcePipelineInput
Reads a pipeline's source data from a CSV or other delimited FileSource using a CSVReader.
See Also:
  • Constructor Details

    • CsvPipelineInput

      public CsvPipelineInput()
  • Method Details

    • getName

      public String getName()
      Description copied from class: PipelineInput
      Returns a display name for this input, such as the source's name followed by its format.
      Overrides:
      getName in class FileSourcePipelineInput
    • 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 PipelineInput
    • fromRecord

      public CsvPipelineInput 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 PipelineInput
      Parameters:
      source -
      Returns:
      this instance.
    • getFileSource

      public FileSource getFileSource()
      Specified by:
      getFileSource in class FileSourcePipelineInput
    • setFileSource

      public CsvPipelineInput setFileSource(FileSource fileSource)
      Specified by:
      setFileSource in class FileSourcePipelineInput
    • getFieldSeparator

      public String getFieldSeparator()
      Returns the string used between field values (defaults to comma).
    • setFieldSeparator

      public CsvPipelineInput setFieldSeparator(String fieldSeparator)
      Sets the string used between field values (defaults to comma).
    • getStartingQuote

      public String getStartingQuote()
      Returns the string that starts a quoted value (defaults to a double quote).
    • setStartingQuote

      public CsvPipelineInput setStartingQuote(String startingQuote)
      Sets the string that starts a quoted value (defaults to a double quote).
    • getEndingQuote

      public String getEndingQuote()
      Returns the string that ends a quoted value (defaults to a double quote).
    • setEndingQuote

      public CsvPipelineInput setEndingQuote(String endingQuote)
      Sets the string that ends a quoted value (defaults to a double quote).
    • getLineSeparators

      public String[] getLineSeparators()
      Returns the strings that separate records (defaults to LF, CRLF and CR).
    • setLineSeparators

      public CsvPipelineInput setLineSeparators(String[] lineSeparators)
      Sets the strings that separate records (defaults to LF, CRLF and CR).
    • getLineSeparatorAsCsvEscaped

      public String getLineSeparatorAsCsvEscaped(String separator)
      Returns the line separators, Java-escaped and joined by the given separator, or an empty string if there are none.
    • getLineSeparatorAsCsvEscaped

      public String getLineSeparatorAsCsvEscaped()
      Returns the line separators as a comma-separated list of Java-escaped strings, as serialized.
    • setLineSeparatorAsCsvEscaped

      public CsvPipelineInput setLineSeparatorAsCsvEscaped(String lineSeparatorsAsCsvEscaped)
      Sets the line separators from a comma-separated list of Java-escaped strings; blank restores the defaults.
    • isAllowMultiLineText

      public boolean isAllowMultiLineText()
      Indicates if line separators are allowed inside quoted fields (defaults to false).
    • setAllowMultiLineText

      public CsvPipelineInput setAllowMultiLineText(boolean allowMultiLineText)
      Indicates if line separators are allowed inside quoted fields (defaults to false).
    • isAllowQuoteInField

      public boolean isAllowQuoteInField()
      Indicates if unescaped quotes are allowed in fields (defaults to false).
    • setAllowQuoteInField

      public CsvPipelineInput setAllowQuoteInField(boolean allowQuoteInField)
      Indicates if unescaped quotes are allowed in fields (defaults to false).
    • isTrimFields

      public boolean isTrimFields()
      Indicates if whitespace around unquoted values is removed (defaults to true).
    • setTrimFields

      public CsvPipelineInput setTrimFields(boolean trimFields)
      Indicates if whitespace around unquoted values is removed (defaults to true).
    • isSkipEmptyRows

      public boolean isSkipEmptyRows()
      Indicates if rows with only null values are skipped (defaults to false).
    • setSkipEmptyRows

      public CsvPipelineInput setSkipEmptyRows(boolean skipEmptyRows)
      Indicates if rows with only null values are skipped (defaults to false).
    • isFieldNamesInFirstRow

      public boolean isFieldNamesInFirstRow()
      Indicates if the first row holds the field names (defaults to false).
    • setFieldNamesInFirstRow

      public CsvPipelineInput setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
      Indicates if the first row holds the field names (defaults to false).
    • createDataReader

      public DataReader createDataReader()
    • generateJavaCode

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

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

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

      public boolean isLineageSupported()
      Description copied from class: PipelineInput
      Indicates if this input can save data lineage on the records it reads (false unless a subclass overrides it).
      Overrides:
      isLineageSupported in class PipelineInput
    • setSaveLineage

      public CsvPipelineInput setSaveLineage(boolean saveLineage)
      Description copied from class: PipelineInput
      Indicates if data lineage (where each record and field came from) is saved on the records read (defaults to false); enabling it throws an exception if lineage is not supported.
      Overrides:
      setSaveLineage in class PipelineInput
    • 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 PipelineInput
    • fromXmlElement

      public CsvPipelineInput fromXmlElement(Element pipelineInputElement)
      Specified by:
      fromXmlElement in interface XmlSerializable
      Overrides:
      fromXmlElement in class PipelineInput