Interface CsvMixin

All Superinterfaces:
CsvEscapeModeAccessor, CsvEscapeModeAccessor.CsvEscapeModeBuilder<CsvMixin>, CsvEscapeModeAccessor.CsvEscapeModeMutator, CsvEscapeModeAccessor.CsvEscapeModeProperty, 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
All Known Implementing Classes:
CsvBuilder

public interface CsvMixin extends CsvEscapeModeAccessor.CsvEscapeModeProperty, CsvEscapeModeAccessor.CsvEscapeModeBuilder<CsvMixin>, org.refcodes.mixin.TrimAccessor.TrimProperty, org.refcodes.mixin.TrimAccessor.TrimBuilder<CsvMixin>, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty, org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<CsvMixin>
This interface defines common functionality for implementations capable of CSV (file) handling.
  • Method Details

    • setCommentPrefixes

      void setCommentPrefixes(String... aCommentPrefixes)
      Sets the prefixes used to identify CSV lines to be ignored.
      Parameters:
      aCommentPrefixes - The prefixes used to identify CSV lines to be ignored.
    • getCommentPrefixes

      String[] getCommentPrefixes()
      Gets the prefixes used to identify CSV lines to be ignored.
      Returns:
      return The prefixes used to identify CSV lines to be ignored.
    • clearCommentPrefixes

      void clearCommentPrefixes()
      Clears the prefixes used to identify CSV lines to be ignored. No CSV lines will be ignored any more.
    • withCommentPrefixes

      CsvMixin withCommentPrefixes(String... aCommentPrefixes)
      Sets the prefixes used to identify CSV lines to be ignored.
      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.
    • isComment

      default boolean isComment(String aLine)
      Tests whether the line starts with a comment prefix.
      Parameters:
      aLine - The line to be tested.
      Returns:
      True in case the line starts with a comment prefix, else false.
    • uncomment

      default String uncomment(String aLine)
      Uncomment the given line in case it is a comment as of isComment(String).
      Parameters:
      aLine - The line to be uncommented.
      Returns:
      The uncommented line.
    • toComment

      default String toComment(String aLine)
      Converts a text to a comment by using the fist defined comment prefix as of getCommentPrefixes() suffixed with a space (" ") followed by the line of text. If no prefix has been set via setCommentPrefixes(String...) or withCommentPrefixes(String...), then the Prefix.CSV_COMMENT is used.
      Parameters:
      aLine - The line to be converted to a comment line.
      Returns:
      The comment accordingly prefixed.