Class Row

java.lang.Object
org.litebridgedb.db.spi.Row
All Implemented Interfaces:
Result

public final class Row extends Object implements Result
A row of data returned by a query. Holds a collection of column-value pairs.

This class provides methods to add columns with associated values, retrieve specific columns, and stream through all columns in the row.

  • Constructor Details

    • Row

      public Row()
  • Method Details

    • withColumn

      public Row withColumn(Column column, @Nullable Object value)
      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 null
      value - the value associated with the specified column; may be null
      Returns:
      the updated Row instance with the new column-value pair added
    • columnStream

      public Stream<Row.RowColumn> columnStream()
      Return a stream of Row.RowColumn objects, each representing a column in the current row along with its associated value.
      Returns:
      a stream of RowColumn objects for all columns in the row
    • column

      public Optional<Row.RowColumn> column(String 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 Optional containing the RowColumn associated with the specified column name if it exists, or an empty Optional if no match is found
    • columnForAlias

      public Optional<Row.RowColumn> columnForAlias(String alias)
      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 Optional containing the RowColumn associated with the specified column name if it exists, or an empty Optional if no match is found
    • column

      public Optional<Row.RowColumn> column(Column column)
    • size

      public int size()
      Returns the total number of columns in the current row.
      Returns:
      the size of the column collection for the row
    • toString

      public String toString()
      Overrides:
      toString in class Object