Package io.github.dornol.excelkit.core
Class RowData
java.lang.Object
io.github.dornol.excelkit.core.RowData
Provides access to all cell data in a single row, indexed by header name or column position.
Used with the mapping-based reader API to support immutable object (e.g., Java record) construction from Excel/CSV rows:
ExcelReader.mapping(row -> new PersonRecord(
row.get("Name").asString(),
row.get("Age").asInt()
)).build(inputStream).read(result -> { ... });
- Since:
- 0.8.0
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
RowData
Constructs a RowData instance.- Parameters:
cells- the cell data for this rowheaderNames- the header names from the fileheaderIndex- a map from header name to column index (built once per file)
-
-
Method Details
-
get
Gets cell data by header name. Returns an emptyCellDataif the column exists but the cell is missing in this row.- Parameters:
headerName- the column header name- Returns:
- the cell data for the specified column
- Throws:
IllegalArgumentException- if the header name is not found
-
get
Gets cell data by column index (0-based). Returns an emptyCellDataif the index is out of bounds for this row.- Parameters:
columnIndex- the 0-based column index- Returns:
- the cell data at the specified index
-
has
Checks whether a header name exists in this row's header definition.- Parameters:
headerName- the header name to check- Returns:
trueif the header exists
-
size
public int size()Returns the number of cells in this row.- Returns:
- the cell count
-
headerNames
Returns the header names from the file.- Returns:
- unmodifiable list of header names
-