java.lang.Object
io.github.astrapi69.file.csv.CsvBean
- All Implemented Interfaces:
Serializable
,Cloneable
The `CsvBean` class represents a structured data model for CSV files. It includes headers, column
types, lines of data, and supports operations like cloning, equality comparison, and fluent
construction using the builder pattern.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder class for constructing `CsvBean` objects. -
Constructor Summary
ConstructorsConstructorDescriptionCsvBean()
Default constructor.Constructs a new `CsvBean` object with specified headers, column types, editable types, and lines.CsvBean
(String[] columnTypes, String[] columnTypesEdit, String[] headers, Map<Integer, Integer> lineOrder, List<String[]> lines) Constructs a new `CsvBean` object with specified column types, editable types, headers, line order, and lines.Constructs a new `CsvBean` object with specified headers, column types, and lines. -
Method Summary
Modifier and TypeMethodDescriptionstatic CsvBean.CsvBeanBuilder
builder()
Creates a builder for constructing `CsvBean` objects.clone()
boolean
String[]
Gets the types of each column in the CSV.String[]
Gets the editable types of each column in the CSV.String[]
Gets the headers of the CSV.Gets the order of lines in the CSV.getLines()
Gets the lines of data in the CSV.int
hashCode()
void
setColumnTypes
(String[] columnTypes) Sets the types of each column in the CSV.void
setColumnTypesEdit
(String[] columnTypesEdit) Sets the editable types of each column in the CSV.void
setHeaders
(String[] headers) Sets the headers of the CSV.void
setLineOrder
(Map<Integer, Integer> lineOrder) Sets the order of lines in the CSV.void
Sets the lines of data in the CSV.Creates a builder initialized with the current `CsvBean` instance's properties.toString()
Returns a string representation of the `CsvBean` object, showing its current column types, editable types, headers, line order, and lines of data.
-
Constructor Details
-
CsvBean
public CsvBean()Default constructor. -
CsvBean
Constructs a new `CsvBean` object with specified headers, column types, and lines.- Parameters:
headers
- the headers of the CSVcolumnTypes
- the types of each columnlines
- the lines of data in the CSV
-
CsvBean
public CsvBean(String[] headers, String[] columnTypes, String[] columnTypesEdit, List<String[]> lines) Constructs a new `CsvBean` object with specified headers, column types, editable types, and lines.- Parameters:
headers
- the headers of the CSVcolumnTypes
- the types of each columncolumnTypesEdit
- the editable types of each columnlines
- the lines of data in the CSV
-
CsvBean
public CsvBean(String[] columnTypes, String[] columnTypesEdit, String[] headers, Map<Integer, Integer> lineOrder, List<String[]> lines) Constructs a new `CsvBean` object with specified column types, editable types, headers, line order, and lines.- Parameters:
columnTypes
- the types of each columncolumnTypesEdit
- the editable types of each columnheaders
- the headers of the CSVlineOrder
- the order of lines in the CSVlines
- the lines of data in the CSV
-
-
Method Details
-
builder
Creates a builder for constructing `CsvBean` objects.- Returns:
- a new `CsvBeanBuilder` instance
-
clone
-
equals
-
getColumnTypes
Gets the types of each column in the CSV.- Returns:
- an array representing the types of each column
-
setColumnTypes
Sets the types of each column in the CSV.- Parameters:
columnTypes
- an array representing the types of each column
-
getColumnTypesEdit
Gets the editable types of each column in the CSV.- Returns:
- an array representing the editable types of each column
-
setColumnTypesEdit
Sets the editable types of each column in the CSV.- Parameters:
columnTypesEdit
- an array representing the editable types of each column
-
getHeaders
Gets the headers of the CSV.- Returns:
- an array representing the headers of the CSV
-
setHeaders
Sets the headers of the CSV.- Parameters:
headers
- an array representing the headers of the CSV
-
getLineOrder
Gets the order of lines in the CSV.- Returns:
- a map representing the order of lines in the CSV
-
setLineOrder
Sets the order of lines in the CSV.- Parameters:
lineOrder
- a map representing the order of lines in the CSV
-
getLines
Gets the lines of data in the CSV.- Returns:
- a list containing arrays representing the lines of data in the CSV
-
setLines
Sets the lines of data in the CSV.- Parameters:
lines
- a list containing arrays representing the lines of data in the CSV
-
hashCode
public int hashCode() -
toBuilder
Creates a builder initialized with the current `CsvBean` instance's properties.- Returns:
- a new `CsvBeanBuilder` initialized with the current instance's properties
-
toString
Returns a string representation of the `CsvBean` object, showing its current column types, editable types, headers, line order, and lines of data.
-