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
This class implements CSV processing functionality.
-
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
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
-
Method Summary
Modifier and TypeMethodDescriptionasFields
(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.String[]
Gets the prefixes used to identify CSV lines to be ignored.Gets the currently setCsvEscapeMode
being used.char
Retrieves the CSV elements from the CSV elements property.Retrieves the CSV line from the CSV line property.boolean
isTrim()
void
setCommentPrefixes
(String... aCommentPrefixes) Sets the prefixes used to identify CSV lines to be ignored.void
setCsvEscapeMode
(CsvEscapeMode aCsvEscapeMode) Sets theCsvEscapeMode
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
Sets the CSV elements for the CSV elements property.void
Sets the CSV elements for the CSV elements property.void
Sets the CSV elements for the CSV elements property.void
Sets the CSV elements for the CSV elements property.void
Sets the CSV elements for the CSV elements property.void
Sets the CSV elements for the CSV elements property.void
Sets the CSV elements for the CSV elements property.void
Sets the CSV elements for the CSV elements property.void
Sets the CSV elements for the CSV elements property.void
Sets the CSV elements for the CSV elements property.void
setFields
(Collection<Object> aFields) Sets the CSV elements for the CSV elements property.void
Sets the CSV line for the CSV line property.void
setTrim
(boolean isTrim) toFields()
Creates a list ofString
elements from the CSV line being set viasetRecord(String)
orwithRecord(String)
.String[]
Creates an array ofString
s from the CSV line being set viasetRecord(String)
orwithRecord(String)
.toRecord()
Creates a CSV line from the elements being set viasetFields(String[])
orwithFields(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).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 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 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 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).To record.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
(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).toString()
TheString
being build by the builder upon the settings of the attributes.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).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).String[]
Creates an array ofString
s from the CSV line being set viasetRecord(String)
orwithRecord(String)
.String[]
Convenience method for thetoFields(String)
method.withCommentPrefixes
(String... aCommentPrefixes) Sets the prefixes used to identify CSV lines to be ignored.withCsvEscapeMode
(CsvEscapeMode aCsvEscapeMode) Sets the rowsCsvEscapeMode
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.withFields
(Collection<Object> aFields) 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.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 interfaceorg.refcodes.mixin.TrimAccessor.TrimMutator
-
isTrim
public boolean isTrim()- Specified by:
isTrim
in interfaceorg.refcodes.mixin.TrimAccessor
-
getCsvEscapeMode
Gets the currently setCsvEscapeMode
being used.- Specified by:
getCsvEscapeMode
in interfaceCsvEscapeModeAccessor
- Returns:
- The currently configured
CsvEscapeMode
s.
-
setCsvEscapeMode
Sets theCsvEscapeMode
to be used.- Specified by:
setCsvEscapeMode
in interfaceCsvEscapeModeAccessor.CsvEscapeModeMutator
- Parameters:
aCsvEscapeMode
- TheCsvEscapeMode
to be stored by theCsvEscapeMode
property.
-
setRecord
Sets the CSV line for the CSV line property.- Parameters:
aRecord
- The CSV line to be stored by the CSV line property.
-
getRecord
Retrieves the CSV line from the CSV line property.- Returns:
- The CSV line stored by the CSV line property.
-
setFields
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
getFields
Retrieves the CSV elements from the CSV elements property.- Returns:
- The CSV elements stored by the CSV elements property.
-
setFields
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 interfaceorg.refcodes.mixin.DelimiterAccessor
-
setDelimiter
public void setDelimiter(char aDelimiterChar) - Specified by:
setDelimiter
in interfaceorg.refcodes.mixin.DelimiterAccessor.DelimiterMutator
-
toFields
Creates a list ofString
elements from the CSV line being set viasetRecord(String)
orwithRecord(String)
.- Returns:
- The elements created from the CSV line.
- Throws:
IllegalStateException
- Thrown in case no elements have been set via thewithFields(String[])
orsetFields(String[])
methods.
-
toRecord
Creates a CSV line from the elements being set viasetFields(String[])
orwithFields(String[])
.- Returns:
- The CSV line created from the CSV line.
- Throws:
IllegalStateException
- Thrown in case no CSV line has been set via thewithRecord(String)
orsetRecord(String)
methods.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toStrings
Creates an array ofString
s from the CSV line being set viasetRecord(String)
orwithRecord(String)
. It should return the same result as an array as a call totoFields()
. Returns null if the record is a comment as ofCsvMixin.isComment(String)
.- Returns:
- The elements created from the CSV line or null if the record is a comment.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toStrings
Convenience method for thetoFields(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
TheString
being build by the builder upon the settings of the attributes. It should return the same result as a call totoRecord()
. -
setCommentPrefixes
Sets the prefixes used to identify CSV lines to be ignored.- Specified by:
setCommentPrefixes
in interfaceCsvMixin
- Parameters:
aCommentPrefixes
- The prefixes used to identify CSV lines to be ignored.
-
getCommentPrefixes
Gets the prefixes used to identify CSV lines to be ignored.- Specified by:
getCommentPrefixes
in interfaceCsvMixin
- 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 interfaceCsvMixin
-
withTrim
- Specified by:
withTrim
in interfaceorg.refcodes.mixin.TrimAccessor.TrimBuilder<CsvMixin>
-
withCsvEscapeMode
Sets the rowsCsvEscapeMode
to use returns this builder as of the Builder-Pattern.- Specified by:
withCsvEscapeMode
in interfaceCsvEscapeModeAccessor.CsvEscapeModeBuilder<CsvMixin>
- Parameters:
aCsvEscapeMode
- TheCsvEscapeMode
to be used when printing a row or the header.- Returns:
- This
CsvEscapeModeAccessor.CsvEscapeModeBuilder
instance to continue configuration.
-
withDelimiter
- Specified by:
withDelimiter
in interfaceorg.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<CsvMixin>
-
withCommentPrefixes
Sets the prefixes used to identify CSV lines to be ignored.- Specified by:
withCommentPrefixes
in interfaceCsvMixin
- 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
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
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
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
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
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
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
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
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
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
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
setFields
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
setFields
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
setFields
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
setFields
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
setFields
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
setFields
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
setFields
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
setFields
Sets the CSV elements for the CSV elements property.- Parameters:
aFields
- The CSV elements to be stored by the CSV elements property.
-
withFields
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
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
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
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
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
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
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
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
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
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
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
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toString
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
To record.- Parameters:
aFields
- the fields- Returns:
- the string
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toRecord
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toString
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toString
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 viawithDelimiter(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 ofwithFields(String...)
withtoRecord()
.- Parameters:
aFields
- The CSV elements to be converted into a record.- Returns:
- The CSV line created from the fields.
-
toFields
Creates an array ofString
s from the CSV line being set viasetRecord(String)
orwithRecord(String)
. It should return the same result as an array as a call totoFields()
. Returns null if the record is a comment as ofCsvMixin.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 viawithDelimiter(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 ofwithRecord(String)
withtoStrings()
.- 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
- TheCsvEscapeMode
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
- TheCsvEscapeMode
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
- TheCsvEscapeMode
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.
-