Class CsvBuilder

java.lang.Object
org.refcodes.textual.CsvBuilder
All Implemented Interfaces:
org.refcodes.mixin.DelimiterAccessor, org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<CsvMixin>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty, org.refcodes.mixin.TrimAccessor, org.refcodes.mixin.TrimAccessor.TrimBuilder<CsvMixin>, org.refcodes.mixin.TrimAccessor.TrimMutator, org.refcodes.mixin.TrimAccessor.TrimProperty, CsvEscapeModeAccessor, CsvEscapeModeAccessor.CsvEscapeModeBuilder<CsvMixin>, CsvEscapeModeAccessor.CsvEscapeModeMutator, CsvEscapeModeAccessor.CsvEscapeModeProperty, CsvMixin

public class CsvBuilder extends Object implements CsvMixin
This class implements CSV processing functionality.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.refcodes.mixin.DelimiterAccessor

    org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty

    Nested classes/interfaces inherited from interface org.refcodes.mixin.TrimAccessor

    org.refcodes.mixin.TrimAccessor.TrimBuilder<B extends org.refcodes.mixin.TrimAccessor.TrimBuilder<B>>, org.refcodes.mixin.TrimAccessor.TrimMutator, org.refcodes.mixin.TrimAccessor.TrimProperty
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<String>
    asFields(String aRecord, char aDelimiter, CsvEscapeMode aCsvEscapeMode, boolean isTrim)
    Creates fields from the given record.
    static String
    asRecord(Collection<Object> aFields, char aDelimiter, CsvEscapeMode aCsvEscapeMode)
    Creates a record from the given fields.
    static String[]
    asStrings(String aRecord, char aDelimiterChar, CsvEscapeMode aCsvEscapeMode, boolean isTrim, String[] aCommentPrefixes)
    Splits a record into dedicated fields.
    void
    Clears the prefixes used to identify CSV lines to be ignored.
    Gets the prefixes used to identify CSV lines to be ignored.
    Gets the currently set CsvEscapeMode being used.
    char
    Retrieves the CSV elements from the CSV elements property.
    Retrieves the CSV line from the CSV line property.
    boolean
    void
    setCommentPrefixes(String... aCommentPrefixes)
    Sets the prefixes used to identify CSV lines to be ignored.
    void
    Sets the CsvEscapeMode to be used.
    void
    setDelimiter(char aDelimiterChar)
    void
    setFields(boolean... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(byte... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(char... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(double... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(float... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(int... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(long... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(short... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(Boolean... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(Byte... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(Character... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(Double... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(Float... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(Integer... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(Long... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(Object... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(Short... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    setFields(String... aFields)
    Sets the CSV elements for the CSV elements property.
    void
    Sets the CSV elements for the CSV elements property.
    void
    setRecord(String aRecord)
    Sets the CSV line for the CSV line property.
    void
    setTrim(boolean isTrim)
    Creates a list of String elements from the CSV line being set via setRecord(String) or withRecord(String).
    toFields(String aRecord)
    Creates an array of Strings from the CSV line being set via setRecord(String) or withRecord(String).
    Creates a CSV line from the elements being set via setFields(String[]) or withFields(String[]).
    toRecord(boolean... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(byte... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(char... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(double... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(float... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(int... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(long... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(short... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(Boolean... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(Byte... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(Character... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(Double... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(Float... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(Integer... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(Long... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(Object... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toRecord(Short... aFields)
    To record.
    toRecord(String... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    The String being build by the builder upon the settings of the attributes.
    toString(Object... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    toString(String... aFields)
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method).
    Creates an array of Strings from the CSV line being set via setRecord(String) or withRecord(String).
    toStrings(String aRecord)
    Convenience method for the toFields(String) method.
    withCommentPrefixes(String... aCommentPrefixes)
    Sets the prefixes used to identify CSV lines to be ignored.
    Sets the rows CsvEscapeMode to use returns this builder as of the Builder-Pattern.
    withDelimiter(char aDelimiterChar)
    withFields(boolean... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(byte... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(char... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(double... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(float... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(int... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(long... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(short... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(Boolean... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(Byte... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(Character... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(Double... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(Float... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(Integer... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(Long... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(Object... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(Short... aFields)
    Sets the CSV elements for the CSV elements property.
    withFields(String... aFields)
    Sets the CSV elements for the CSV elements property.
    Sets the CSV elements for the CSV elements property.
    withRecord(String aRecord)
    Sets the CSV line for the CSV line property.
    withTrim(boolean isTrim)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeProperty

    letCsvEscapeMode

    Methods inherited from interface org.refcodes.textual.CsvMixin

    isComment, toComment, uncomment

    Methods inherited from interface org.refcodes.mixin.DelimiterAccessor.DelimiterProperty

    letDelimiter

    Methods inherited from interface org.refcodes.mixin.TrimAccessor.TrimProperty

    letTrim
  • Constructor Details

    • CsvBuilder

      public CsvBuilder()
  • Method Details

    • setTrim

      public void setTrim(boolean isTrim)
      Specified by:
      setTrim in interface org.refcodes.mixin.TrimAccessor.TrimMutator
    • isTrim

      public boolean isTrim()
      Specified by:
      isTrim in interface org.refcodes.mixin.TrimAccessor
    • getCsvEscapeMode

      public CsvEscapeMode getCsvEscapeMode()
      Gets the currently set CsvEscapeMode being used.
      Specified by:
      getCsvEscapeMode in interface CsvEscapeModeAccessor
      Returns:
      The currently configured CsvEscapeModes.
    • setCsvEscapeMode

      public void setCsvEscapeMode(CsvEscapeMode aCsvEscapeMode)
      Sets the CsvEscapeMode to be used.
      Specified by:
      setCsvEscapeMode in interface CsvEscapeModeAccessor.CsvEscapeModeMutator
      Parameters:
      aCsvEscapeMode - The CsvEscapeMode to be stored by the CsvEscapeMode property.
    • setRecord

      public void setRecord(String aRecord)
      Sets the CSV line for the CSV line property.
      Parameters:
      aRecord - The CSV line to be stored by the CSV line property.
    • getRecord

      public String getRecord()
      Retrieves the CSV line from the CSV line property.
      Returns:
      The CSV line stored by the CSV line property.
    • setFields

      public void setFields(Object... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • getFields

      public Collection<Object> getFields()
      Retrieves the CSV elements from the CSV elements property.
      Returns:
      The CSV elements stored by the CSV elements property.
    • setFields

      public void setFields(Collection<Object> aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • getDelimiter

      public char getDelimiter()
      Specified by:
      getDelimiter in interface org.refcodes.mixin.DelimiterAccessor
    • setDelimiter

      public void setDelimiter(char aDelimiterChar)
      Specified by:
      setDelimiter in interface org.refcodes.mixin.DelimiterAccessor.DelimiterMutator
    • toFields

      public List<String> toFields() throws IllegalStateException
      Creates a list of String elements from the CSV line being set via setRecord(String) or withRecord(String).
      Returns:
      The elements created from the CSV line.
      Throws:
      IllegalStateException - Thrown in case no elements have been set via the withFields(String[]) or setFields(String[]) methods.
    • toRecord

      public String toRecord() throws IllegalStateException
      Creates a CSV line from the elements being set via setFields(String[]) or withFields(String[]).
      Returns:
      The CSV line created from the CSV line.
      Throws:
      IllegalStateException - Thrown in case no CSV line has been set via the withRecord(String) or setRecord(String) methods.
    • toRecord

      public String toRecord(Object... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(Collection<Object> aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toStrings

      public String[] toStrings() throws IllegalStateException
      Creates an array of Strings from the CSV line being set via setRecord(String) or withRecord(String). It should return the same result as an array as a call to toFields(). Returns null if the record is a comment as of CsvMixin.isComment(String).
      Returns:
      The elements created from the CSV line or null if the record is a comment.
      Throws:
      IllegalStateException
    • toRecord

      public String toRecord(String... aFields) throws IllegalStateException
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
      Throws:
      IllegalStateException
    • toStrings

      public String[] toStrings(String aRecord)
      Convenience method for the toFields(String) method.
      Parameters:
      aRecord - The CSV line to be stored by the CSV line property.
      Returns:
      The elements created from the CSV line or null if the record is a comment.
    • toString

      public String toString() throws IllegalStateException
      The String being build by the builder upon the settings of the attributes. It should return the same result as a call to toRecord().
      Overrides:
      toString in class Object
      Returns:
      The according resulting String
      Throws:
      IllegalStateException
    • setCommentPrefixes

      public void setCommentPrefixes(String... aCommentPrefixes)
      Sets the prefixes used to identify CSV lines to be ignored.
      Specified by:
      setCommentPrefixes in interface CsvMixin
      Parameters:
      aCommentPrefixes - The prefixes used to identify CSV lines to be ignored.
    • getCommentPrefixes

      public String[] getCommentPrefixes()
      Gets the prefixes used to identify CSV lines to be ignored.
      Specified by:
      getCommentPrefixes in interface CsvMixin
      Returns:
      return The prefixes used to identify CSV lines to be ignored.
    • clearCommentPrefixes

      public void clearCommentPrefixes()
      Clears the prefixes used to identify CSV lines to be ignored. No CSV lines will be ignored any more.
      Specified by:
      clearCommentPrefixes in interface CsvMixin
    • withTrim

      public CsvBuilder withTrim(boolean isTrim)
      Specified by:
      withTrim in interface org.refcodes.mixin.TrimAccessor.TrimBuilder<CsvMixin>
    • withCsvEscapeMode

      public CsvBuilder withCsvEscapeMode(CsvEscapeMode aCsvEscapeMode)
      Sets the rows CsvEscapeMode to use returns this builder as of the Builder-Pattern.
      Specified by:
      withCsvEscapeMode in interface CsvEscapeModeAccessor.CsvEscapeModeBuilder<CsvMixin>
      Parameters:
      aCsvEscapeMode - The CsvEscapeMode to be used when printing a row or the header.
      Returns:
      This CsvEscapeModeAccessor.CsvEscapeModeBuilder instance to continue configuration.
    • withDelimiter

      public CsvBuilder withDelimiter(char aDelimiterChar)
      Specified by:
      withDelimiter in interface org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<CsvMixin>
    • withCommentPrefixes

      public CsvBuilder withCommentPrefixes(String... aCommentPrefixes)
      Sets the prefixes used to identify CSV lines to be ignored.
      Specified by:
      withCommentPrefixes in interface CsvMixin
      Parameters:
      aCommentPrefixes - The prefixes used to identify CSV lines to be ignored.
      Returns:
      The instance on which this method has been invoked as of the builder pattern.
    • withRecord

      public CsvBuilder withRecord(String aRecord)
      Sets the CSV line for the CSV line property.
      Parameters:
      aRecord - The CSV line to be stored by the CSV line property.
      Returns:
      The builder for applying multiple build operations.
    • setFields

      public void setFields(boolean... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(byte... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(short... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(int... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(long... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(float... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(double... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(char... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • withFields

      public CsvBuilder withFields(boolean... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(byte... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(short... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(int... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(long... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(float... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(double... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(char... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • setFields

      public void setFields(Boolean... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(Byte... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(Short... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(Integer... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(Long... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(Float... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(Double... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(Character... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • setFields

      public void setFields(String... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
    • withFields

      public CsvBuilder withFields(Object... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(Boolean... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(Byte... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(Short... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(Integer... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(Long... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(Float... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(Double... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(Character... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(String... aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • withFields

      public CsvBuilder withFields(Collection<Object> aFields)
      Sets the CSV elements for the CSV elements property.
      Parameters:
      aFields - The CSV elements to be stored by the CSV elements property.
      Returns:
      The builder for applying multiple build operations.
    • toRecord

      public String toRecord(boolean... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(byte... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(short... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(int... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(long... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(float... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(double... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(char... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toString

      public String toString(Object... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(Boolean... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(Byte... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(Short... aFields)
      To record.
      Parameters:
      aFields - the fields
      Returns:
      the string
    • toRecord

      public String toRecord(Integer... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(Long... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(Float... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(Double... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toRecord

      public String toRecord(Character... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toString

      public String toString(String... aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toString

      public String toString(Collection<Object> aFields)
      Creates a CSV line from the fields being provided This method is to be side effect free in terms of the fields (and the resulting record) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the fields (and the resulting record), use this method instead of the combination of withFields(String...) with toRecord().
      Parameters:
      aFields - The CSV elements to be converted into a record.
      Returns:
      The CSV line created from the fields.
    • toFields

      public String[] toFields(String aRecord)
      Creates an array of Strings from the CSV line being set via setRecord(String) or withRecord(String). It should return the same result as an array as a call to toFields(). Returns null if the record is a comment as of CsvMixin.isComment(String). This method is to be side effect free in terms of the record (and the resulting fields) is not part of the state for this instance (from the point of view of this method). Still changing for example the delimiter via withDelimiter(char) can cause side effects! For avoiding thread race conditions / side effects regarding the record (and the resulting fields), use this method instead of the combination of withRecord(String) with toStrings().
      Parameters:
      aRecord - The CSV line to be stored by the CSV line property.
      Returns:
      The elements created from the CSV line or null if the record is a comment.
    • asFields

      public static List<String> asFields(String aRecord, char aDelimiter, CsvEscapeMode aCsvEscapeMode, boolean isTrim)
      Creates fields from the given record.
      Parameters:
      aRecord - The record to use.
      aDelimiter - The delimiter to use.
      aCsvEscapeMode - The CsvEscapeMode to use.
      isTrim - True in case the record and the resulting fields are to be trimmed.
      Returns:
      The according record.
    • asRecord

      public static String asRecord(Collection<Object> aFields, char aDelimiter, CsvEscapeMode aCsvEscapeMode)
      Creates a record from the given fields.
      Parameters:
      aFields - The fields to use.
      aDelimiter - The delimiter to use.
      aCsvEscapeMode - The CsvEscapeMode to use.
      Returns:
      The according record.
    • asStrings

      public static String[] asStrings(String aRecord, char aDelimiterChar, CsvEscapeMode aCsvEscapeMode, boolean isTrim, String[] aCommentPrefixes)
      Splits a record into dedicated fields.
      Parameters:
      aRecord - The record which to split into dedicated fields.
      aDelimiterChar - The delimiter denoting the end of a value.
      aCsvEscapeMode - The CsvEscapeMode to use.
      isTrim - Whether to trim the record and the resulting fields.
      aCommentPrefixes - The prefixes used to identify comments.
      Returns:
      The according fields from the record.