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
CsvEscapeModeAccessor.CsvEscapeModeBuilder<B extends CsvEscapeModeAccessor.CsvEscapeModeBuilder<?>>, CsvEscapeModeAccessor.CsvEscapeModeMutator, CsvEscapeModeAccessor.CsvEscapeModeProperty
org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
Constructor | Description |
---|---|
CsvBuilder() |
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 |
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.
|
CsvEscapeMode |
getCsvEscapeMode() |
Gets the currently set
CsvEscapeMode being used. |
char |
getDelimiter() |
|
Collection<Object> |
getFields() |
Retrieves the CSV elements from the CSV elements property.
|
String |
getRecord() |
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 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 |
setFields(Collection<Object> aFields) |
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) |
|
List<String> |
toFields() |
Creates a list of
String elements from the CSV line being set via
setRecord(String) or withRecord(String) . |
String[] |
toFields(String aRecord) |
Creates an array of
String s from the CSV line being set via
setRecord(String) or withRecord(String) . |
String |
toRecord() |
Creates a CSV line from the elements being set via
setFields(String[]) or withFields(String[]) . |
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
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).
|
String |
toRecord(Short... aFields) |
To record.
|
String |
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).
|
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).
|
String |
toString() |
The
String being build by the builder upon the settings of the
attributes. |
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).
|
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).
|
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).
|
String[] |
toStrings() |
Creates an array of
String s from the CSV line being set via
setRecord(String) or withRecord(String) . |
String[] |
toStrings(String aRecord) |
Convenience method for the
toFields(String) method. |
CsvBuilder |
withCommentPrefixes(String... aCommentPrefixes) |
Sets the prefixes used to identify CSV lines to be ignored.
|
CsvBuilder |
withCsvEscapeMode(CsvEscapeMode aCsvEscapeMode) |
Sets the rows
CsvEscapeMode to use returns this builder as of
the Builder-Pattern. |
CsvBuilder |
withDelimiter(char aDelimiterChar) |
|
CsvBuilder |
withFields(boolean... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(byte... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(char... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(double... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(float... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(int... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(long... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(short... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Boolean... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Byte... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Character... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Double... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Float... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Integer... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Long... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Object... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Short... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(String... aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withFields(Collection<Object> aFields) |
Sets the CSV elements for the CSV elements property.
|
CsvBuilder |
withRecord(String aRecord) |
Sets the CSV line for the CSV line property.
|
CsvBuilder |
withTrim(boolean isTrim) |
letCsvEscapeMode
letDelimiter
public void setTrim(boolean isTrim)
setTrim
in interface org.refcodes.mixin.TrimAccessor.TrimMutator
public boolean isTrim()
isTrim
in interface org.refcodes.mixin.TrimAccessor
public CsvEscapeMode getCsvEscapeMode()
CsvEscapeMode
being used.getCsvEscapeMode
in interface CsvEscapeModeAccessor
CsvEscapeMode
s.public void setCsvEscapeMode(CsvEscapeMode aCsvEscapeMode)
CsvEscapeMode
to be used.setCsvEscapeMode
in interface CsvEscapeModeAccessor.CsvEscapeModeMutator
aCsvEscapeMode
- The CsvEscapeMode
to be stored by the
CsvEscapeMode
property.public void setRecord(String aRecord)
aRecord
- The CSV line to be stored by the CSV line property.public String getRecord()
public void setFields(Object... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public Collection<Object> getFields()
public void setFields(Collection<Object> aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public char getDelimiter()
getDelimiter
in interface org.refcodes.mixin.DelimiterAccessor
public void setDelimiter(char aDelimiterChar)
setDelimiter
in interface org.refcodes.mixin.DelimiterAccessor.DelimiterMutator
public List<String> toFields() throws IllegalStateException
String
elements from the CSV line being set via
setRecord(String)
or withRecord(String)
.IllegalStateException
- Thrown in case no elements have been set
via the withFields(String[])
or
setFields(String[])
methods.public String toRecord() throws IllegalStateException
setFields(String[])
or withFields(String[])
.IllegalStateException
- Thrown in case no CSV line has been set via
the withRecord(String)
or setRecord(String)
methods.public String toRecord(Object... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(Collection<Object> aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String[] toStrings() throws IllegalStateException
String
s 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)
.IllegalStateException
public String toRecord(String... aFields) throws IllegalStateException
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()
.aFields
- The CSV elements to be converted into a record.IllegalStateException
public String[] toStrings(String aRecord)
toFields(String)
method.aRecord
- The CSV line to be stored by the CSV line property.public String toString() throws IllegalStateException
String
being build by the builder upon the settings of the
attributes. It should return the same result as a call to
toRecord()
.toString
in class Object
String
IllegalStateException
public void setCommentPrefixes(String... aCommentPrefixes)
setCommentPrefixes
in interface CsvMixin
aCommentPrefixes
- The prefixes used to identify CSV lines to be
ignored.public String[] getCommentPrefixes()
getCommentPrefixes
in interface CsvMixin
public void clearCommentPrefixes()
clearCommentPrefixes
in interface CsvMixin
public CsvBuilder withTrim(boolean isTrim)
withTrim
in interface org.refcodes.mixin.TrimAccessor.TrimBuilder<CsvMixin>
public CsvBuilder withCsvEscapeMode(CsvEscapeMode aCsvEscapeMode)
CsvEscapeMode
to use returns this builder as of
the Builder-Pattern.withCsvEscapeMode
in interface CsvEscapeModeAccessor.CsvEscapeModeBuilder<CsvMixin>
aCsvEscapeMode
- The CsvEscapeMode
to be used when
printing a row or the header.CsvEscapeModeAccessor.CsvEscapeModeBuilder
instance to continue
configuration.public CsvBuilder withDelimiter(char aDelimiterChar)
withDelimiter
in interface org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<CsvMixin>
public CsvBuilder withCommentPrefixes(String... aCommentPrefixes)
withCommentPrefixes
in interface CsvMixin
aCommentPrefixes
- The prefixes used to identify CSV lines to be
ignored.public CsvBuilder withRecord(String aRecord)
aRecord
- The CSV line to be stored by the CSV line property.public void setFields(boolean... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(byte... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(short... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(int... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(long... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(float... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(double... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(char... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(boolean... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(byte... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(short... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(int... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(long... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(float... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(double... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(char... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(Boolean... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(Byte... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(Short... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(Integer... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(Long... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(Float... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(Double... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(Character... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public void setFields(String... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Object... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Boolean... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Byte... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Short... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Integer... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Long... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Float... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Double... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Character... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(String... aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public CsvBuilder withFields(Collection<Object> aFields)
aFields
- The CSV elements to be stored by the CSV elements
property.public String toRecord(boolean... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(byte... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(short... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(int... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(long... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(float... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(double... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(char... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toString(Object... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(Boolean... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(Byte... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(Short... aFields)
aFields
- the fieldspublic String toRecord(Integer... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(Long... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(Float... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(Double... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toRecord(Character... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toString(String... aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String toString(Collection<Object> aFields)
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()
.aFields
- The CSV elements to be converted into a record.public String[] toFields(String aRecord)
String
s 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()
.aRecord
- The CSV line to be stored by the CSV line property.public static List<String> asFields(String aRecord, char aDelimiter, CsvEscapeMode aCsvEscapeMode, boolean isTrim)
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.public static String asRecord(Collection<Object> aFields, char aDelimiter, CsvEscapeMode aCsvEscapeMode)
aFields
- The fields to use.aDelimiter
- The delimiter to use.aCsvEscapeMode
- The CsvEscapeMode
to use.public static String[] asStrings(String aRecord, char aDelimiterChar, CsvEscapeMode aCsvEscapeMode, boolean isTrim, String[] aCommentPrefixes)
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.Copyright © 2021. All rights reserved.