java.lang.Object
org.litebridge.db.spi.Row
- All Implemented Interfaces:
Result
A row of data returned by a query. Holds a collection of column-value pairs.
This class provides methods to add expressions with associated values, retrieve specific expressions, and stream through all expressions in the row.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classA combination of a column and its associated value within a row. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncolumn(int index) Retrieves a column from the row by its index.Retrieve a column from the row by its name if it exists.Retrieves a column from the row by itsColumnmetadata.columnForAlias(String alias) Retrieve a column from the row by its name if it exists.columns()Returns a list of all columns in the current row.Return a stream ofRow.RowColumnobjects, each representing a column in the current row along with its associated value.intsize()Returns the total number of expressions in the current row.toString()voidupdateColumn(Column column, @Nullable Object value) Updates the value of an existing column in the row.Return a stream of objects containing the values of the results in this row.withColumn(Column column, @Nullable Object value) Add a new column-value pair to the row and return the updated instance.
-
Constructor Details
-
Row
public Row()
-
-
Method Details
-
withColumn
Add a new column-value pair to the row and return the updated instance.If the column already exists, its value will be replaced with the new value provided.
- Parameters:
column- the column to add or update within the row; must not be nullvalue- the value associated with the specified column; may be null- Returns:
- the updated
Rowinstance with the new column-value pair added
-
updateColumn
Updates the value of an existing column in the row.- Parameters:
column- the column to updatevalue- the new value for the column
-
columnStream
Return a stream ofRow.RowColumnobjects, each representing a column in the current row along with its associated value.- Returns:
- a stream of
RowColumnobjects for all columns in the row
-
columns
Returns a list of all columns in the current row.- Returns:
- a list of
RowColumnobjects
-
valueStream
Return a stream of objects containing the values of the results in this row.- Returns:
- a stream of objects for all values in the row
-
column
Retrieve a column from the row by its name if it exists.- Parameters:
column- the name of the column to retrieve; must not be null- Returns:
- an
Optionalcontaining theRowColumnassociated with the specified column name if it exists, or an emptyOptionalif no match is found
-
column
Retrieves a column from the row by its index.- Parameters:
index- the index of the column to retrieve- Returns:
- the
RowColumnat the specified index
-
columnForAlias
Retrieve a column from the row by its name if it exists.- Parameters:
alias- the alias of the column to retrieve; must not be null- Returns:
- an
Optionalcontaining theRowColumnassociated with the specified column name if it exists, or an emptyOptionalif no match is found
-
column
Retrieves a column from the row by itsColumnmetadata.- Parameters:
column- the column metadata to match- Returns:
- an
Optionalcontaining theRowColumnif found, or empty otherwise
-
size
public int size()Returns the total number of expressions in the current row.- Returns:
- the size of the column collection for the row
-
toString
-