-
- 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.textual.CsvEscapeModeAccessor
CsvEscapeModeAccessor.CsvEscapeModeBuilder<B extends CsvEscapeModeAccessor.CsvEscapeModeBuilder<?>>, CsvEscapeModeAccessor.CsvEscapeModeMutator, CsvEscapeModeAccessor.CsvEscapeModeProperty
-
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
-
-
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.String[]
getCommentPrefixes()
Gets the prefixes used to identify CSV lines to be ignored.default boolean
isComment(String aLine)
Tests whether the line starts with a comment prefix.void
setCommentPrefixes(String... aCommentPrefixes)
Sets the prefixes used to identify CSV lines to be ignored.default String
toComment(String aLine)
Converts a text to a comment by using the fist defined comment prefix as ofgetCommentPrefixes()
suffixed with a space (" ") followed by the line of text.default String
uncomment(String aLine)
Uncomment the given line in case it is a comment as ofisComment(String)
.CsvMixin
withCommentPrefixes(String... aCommentPrefixes)
Sets the prefixes used to identify CSV lines to be ignored.-
Methods inherited from interface org.refcodes.textual.CsvEscapeModeAccessor
getCsvEscapeMode
-
Methods inherited from interface org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder
withCsvEscapeMode
-
Methods inherited from interface org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeMutator
setCsvEscapeMode
-
Methods inherited from interface org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeProperty
letCsvEscapeMode
-
Methods inherited from interface org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder
withDelimiter
-
-
-
-
Method Detail
-
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 ofisComment(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 ofgetCommentPrefixes()
suffixed with a space (" ") followed by the line of text. If no prefix has been set viasetCommentPrefixes(String...)
orwithCommentPrefixes(String...)
, then thePrefix.CSV_COMMENT
is used.- Parameters:
aLine
- The line to be converted to a comment line.- Returns:
- The comment accordingly prefixed.
-
-