java.lang.Object
org.litebridge.db.spi.Row
A row of data returned from a database query.
Represents a row within a dataset, containing a collection of RowColumn objects.
Each column in the row can be accessed either by its index or by its label/alias.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncolumn(int index) Retrieves the column at the given index.Retrieves the column with the given label/alias.Provides a map of column labels toRowColumnobjects for the current row.columns()Returns the list of columns in this row.booleaninthashCode()intRetrieves the index of a column from the row by its name.intRetrieves the index of a column from the row by itsColumnmetadata.intsize()Returns the number of columns in this row.intComputes or returns the cached structural hash code of this row.toString()@Nullable Objectvalue(int index) Retrieves the value of the column at the given index.@Nullable ObjectRetrieves the value of the column with the given label/alias.
-
Constructor Details
-
Row
-
-
Method Details
-
columns
Returns the list of columns in this row.- Returns:
- The list of row columns
-
columnMap
Provides a map of column labels toRowColumnobjects for the current row.The underlying map implementation is a
LinkedHashMap, preserving the order of columns.If the underlying map is not already initialised, it will be created and populated with the columns in this row; subsequent calls will return the same map.
- Returns:
- A map where the keys are column labels (strings) and the values
are the corresponding
RowColumnobjects.
-
value
Retrieves the value of the column at the given index.- Parameters:
index- The row column index- Returns:
- The row column value
- Throws:
IndexOutOfBoundsException- if an invalid column index is specified
-
value
Retrieves the value of the column with the given label/alias.- Parameters:
label- The row column label (column name or alias)- Returns:
- The row column value
- Throws:
NoSuchElementException- if the column is not found
-
column
Retrieves the column at the given index.- Parameters:
index- The row column index- Returns:
- The row column
- Throws:
IndexOutOfBoundsException- if an invalid column index is specified
-
column
Retrieves the column with the given label/alias.- Parameters:
label- The row column label (column name or alias)- Returns:
- The row column
- Throws:
NoSuchElementException- if the column is not found
-
indexOf
Retrieves the index of a column from the row by itsColumnmetadata.- Parameters:
column- the column metadata to match- Returns:
- the index of the column if found, or -1 otherwise
-
indexOf
Retrieves the index of a column from the row by its name.- Parameters:
label- the label of the column to retrieve- Returns:
- the index of the column if found, or -1 otherwise
-
size
public int size()Returns the number of columns in this row.- Returns:
- The number of columns
-
structureHashCode
public int structureHashCode()Computes or returns the cached structural hash code of this row.The structural hash code is based solely on the structure of the columns (labels, aliases, column metadata), ignoring row data values.
- Returns:
- the structural hash code of this row
-
equals
-
hashCode
public int hashCode() -
toString
-