Interface CsvMixin

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void clearCommentPrefixes​()
      Clears the prefixes used to identify CSV lines to be ignored.
      java.lang.String[] getCommentPrefixes​()
      Gets the prefixes used to identify CSV lines to be ignored.
      default boolean isComment​(java.lang.String aLine)
      Tests whether the line starts with a comment prefix.
      void setCommentPrefixes​(java.lang.String... aCommentPrefixes)
      Sets the prefixes used to identify CSV lines to be ignored.
      default java.lang.String toComment​(java.lang.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.
      default java.lang.String uncomment​(java.lang.String aLine)
      Uncomment the given line in case it is a comment as of isComment(String).
      CsvMixin withCommentPrefixes​(java.lang.String... aCommentPrefixes)
      Sets the prefixes used to identify CSV lines to be ignored.
      • Methods inherited from interface org.refcodes.mixin.DelimiterAccessor

        getDelimiter
      • Methods inherited from interface org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder

        withDelimiter
      • Methods inherited from interface org.refcodes.mixin.DelimiterAccessor.DelimiterMutator

        setDelimiter
      • Methods inherited from interface org.refcodes.mixin.TrimAccessor

        isTrim
      • Methods inherited from interface org.refcodes.mixin.TrimAccessor.TrimBuilder

        withTrim
      • Methods inherited from interface org.refcodes.mixin.TrimAccessor.TrimMutator

        setTrim
    • Method Detail

      • setCommentPrefixes

        void setCommentPrefixes​(java.lang.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

        java.lang.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​(java.lang.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​(java.lang.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 java.lang.String uncomment​(java.lang.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 java.lang.String toComment​(java.lang.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, then an IllegalStateException will be thrown.
        Parameters:
        aLine - The line to be converted to a comment line.
        Returns:
        The comment accordingly prefixed.
        Throws:
        java.lang.IllegalStateException - in case no comment prefixes have been set via setCommentPrefixes(String...) or withCommentPrefixes(String...).