Class CsvSplitterConfig

All Implemented Interfaces:
Labelable

public class CsvSplitterConfig extends BaseDocumentSplitterConfig

Split files with Coma-Separated values (or any other characters, like tab) into one document per line.

Can be used both as a pre-parse (text documents) or post-parse handler documents.

Given this sample CSV file content...

 'clientId','clientName','clientOrg','orgDesc'
 '123','Joe Dalton','ACME Inc.','Organization\'s description'
 '345','Avrel Dalton','Daisy Town','Another one'
 

... the above example will split the file into two documents (one for each row after the header row):

See Also:
  • Field Details

    • DEFAULT_SEPARATOR_CHARACTER

      public static final char DEFAULT_SEPARATOR_CHARACTER
      See Also:
    • DEFAULT_QUOTE_CHARACTER

      public static final char DEFAULT_QUOTE_CHARACTER
      See Also:
    • DEFAULT_ESCAPE_CHARACTER

      public static final char DEFAULT_ESCAPE_CHARACTER
      See Also:
  • Constructor Details

    • CsvSplitterConfig

      public CsvSplitterConfig()
  • Method Details

    • setFieldMatcher

      public CsvSplitterConfig setFieldMatcher(TextMatcher fieldMatcher)
    • getContentColumns

      public List<String> getContentColumns()
      One or several columns containing the text to be considered as the document "content".
      Returns:
      content columns
    • setContentColumns

      public CsvSplitterConfig setContentColumns(List<String> contentColumns)
      One or several columns containing the text to be considered as the document "content".
      Parameters:
      contentColumns - content columns
      Returns:
      this instance
    • getFieldMatcher

      public TextMatcher getFieldMatcher()
      Matcher of one or more fields to use as the source of content to split into new documents, instead of the original document content.
      Returns:
      field matcher
    • getSeparatorCharacter

      public char getSeparatorCharacter()
      The value-separator character. Default is the comma character (,).
      Returns:
      value-separator character
    • getQuoteCharacter

      public char getQuoteCharacter()
      The value's surrounding quotes character. Default is the double-quote character (").
      Returns:
      value's surrounding quotes character
    • getEscapeCharacter

      public char getEscapeCharacter()
      The escape character. Default is the backslash character (\).
      Returns:
      escape character
    • isUseFirstRowAsFields

      public boolean isUseFirstRowAsFields()
      Whether to use the first row as field names for values. Default is false.
      Returns:
      true if using first row as field names.
    • getLinesToSkip

      public int getLinesToSkip()
      The number of lines to skip before starting to parse lines. Default is 0.
      Returns:
      the number of lines to skip
    • getReferenceColumn

      public String getReferenceColumn()
      The column containing the unique document reference. Can be either a column name or position, starting at 1.
      Returns:
      column name or position
    • setSeparatorCharacter

      public CsvSplitterConfig setSeparatorCharacter(char separatorCharacter)
      The value-separator character. Default is the comma character (,).
      Parameters:
      separatorCharacter - value-separator character
      Returns:
      this.
    • setQuoteCharacter

      public CsvSplitterConfig setQuoteCharacter(char quoteCharacter)
      The value's surrounding quotes character. Default is the double-quote character (").
      Parameters:
      quoteCharacter - value's surrounding quotes character
      Returns:
      this.
    • setEscapeCharacter

      public CsvSplitterConfig setEscapeCharacter(char escapeCharacter)
      The escape character. Default is the backslash character (\).
      Parameters:
      escapeCharacter - escape character
      Returns:
      this.
    • setUseFirstRowAsFields

      public CsvSplitterConfig setUseFirstRowAsFields(boolean useFirstRowAsFields)
      Whether to use the first row as field names for values. Default is false.
      Parameters:
      useFirstRowAsFields - true if using first row as field names
      Returns:
      this.
    • setLinesToSkip

      public CsvSplitterConfig setLinesToSkip(int linesToSkip)
      The number of lines to skip before starting to parse lines. Default is 0.
      Parameters:
      linesToSkip - the number of lines to skip
      Returns:
      this.
    • setReferenceColumn

      public CsvSplitterConfig setReferenceColumn(String referenceColumn)
      The column containing the unique document reference. Can be either a column name or position, starting at 1.
      Parameters:
      referenceColumn - column name or position
      Returns:
      this.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class BaseDocumentSplitterConfig
    • canEqual

      protected boolean canEqual(Object other)
      Overrides:
      canEqual in class BaseDocumentSplitterConfig
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BaseDocumentSplitterConfig
    • toString

      public String toString()
      Overrides:
      toString in class BaseDocumentSplitterConfig