Class Row

  • All Implemented Interfaces:
    Iterator<Row>

    public class Row
    extends Object
    implements Iterator<Row>
    Represents a row in a Relation (either a Table or TableSlice), allowing iteration over the relation. During iteration, the Row slides over the table row-wise, exposing data as it advances, acting as a cursor into the table. There is only one Row object for the entire table during iteration.

    Implementation Note: The row is always implemented over a TableSlice. If the constructor argument is a table, it is wrapped by a slice over the whole table.

    • Constructor Summary

      Constructors 
      Constructor Description
      Row​(Table table)
      Constructs a Row object for the given table
      Row​(Table table, int rowNumber)
      Constructs a Row object for the given Table, with the Row positioned at the given 0-based index
      Row​(TableSlice tableSlice)
      Constructs a Row object for the given TableSlice
      Row​(TableSlice tableSlice, int rowNumber)
      Constructs a Row object for the given TableSlice, with the Row positioned at the given 0-based index
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void at​(int rowNumber)
      Moves this Row to the given 0-based row index
      Column<?> column​(int columnIndex)  
      int columnCount()
      Returns the number of columns in this Row
      List<String> columnNames()
      Returns a list containing the names of each column in the row
      boolean equals​(Object obj)
      Returns true if every value is equal to the corresponding value in the given row
      int getBackingRowNumber()
      Returns the row number in the table backing the slice behind this row.
      Boolean getBoolean​(int columnIndex)
      Returns a Boolean value from this Row at the given column index.
      Boolean getBoolean​(String columnName)
      Returns a Boolean value from this Row at the column of the given name.
      byte getBooleanAsByte​(int columnIndex)
      Returns an element from a Boolean column in its internal byte form, avoiding boxing
      byte getBooleanAsByte​(String columnName)
      Returns an element from a Boolean column in its internal byte form, avoiding boxing
      ColumnType getColumnType​(int columnIndex)  
      ColumnType getColumnType​(String columnName)
      Returns the type of the named column
      LocalDate getDate​(int columnIndex)
      Returns a LocalDate value from this Row at the column with the given index.
      LocalDate getDate​(String columnName)
      Returns a LocalDate value from this Row at the column of the given name.
      LocalDateTime getDateTime​(int columnIndex)
      Returns a LocalDateTime from this Row at the column with the given index.
      LocalDateTime getDateTime​(String columnName)
      Returns a LocalDateTime value from this Row at the column of the given name.
      double getDouble​(int columnIndex)
      Returns a double from this Row at the column with the given index.
      double getDouble​(String columnName)
      Returns a double from this Row at the column of the given name.
      float getFloat​(int columnIndex)
      Returns a float from this Row at the column with the given index.
      float getFloat​(String columnName)
      Returns a float from this Row at the column of the given name.
      Instant getInstant​(int columnIndex)
      Returns an Instant from this Row at the column with the given index.
      Instant getInstant​(String columnName)
      Returns an Instant value from this Row at the column of the given name.
      int getInt​(int columnIndex)
      Returns an int from this Row at the column with the given index.
      int getInt​(String columnName)
      Returns an int from this Row at the column of the given name.
      long getLong​(int columnIndex)
      Returns a long from this Row at the column with the given index.
      long getLong​(String columnName)
      Returns a long from this Row at the column of the given name.
      double getNumber​(String columnName)
      Returns a double representing the value held in the column with the given name at this row, for any numeric column type
      Object getObject​(int columnIndex)
      Returns an Object representing the LocalTime from this Row at the column with the given index.
      Object getObject​(String columnName)
      Returns an Object representing the value from this Row at the column of the given name.
      int getPackedDate​(int columnIndex)
      Returns an int representing the LocalTime from this Row at the column with the given index.
      int getPackedDate​(String columnName)
      Returns an int representing the LocalDate from this Row at the column of the given name.
      long getPackedDateTime​(int columnIndex)
      Returns an long representing the LocalTime from this Row at the column with the given index.
      long getPackedDateTime​(String columnName)
      Returns a long representing the LocalDateTime from this Row at the column of the given name.
      long getPackedInstant​(int columnIndex)
      Returns an long representing the LocalTime from this Row at the column with the given index.
      long getPackedInstant​(String columnName)
      Returns a long representing the Instant from this Row at the column of the given name.
      int getPackedTime​(int columnIndex)
      Returns an int representing the LocalTime from this Row at the column with the given index.
      int getPackedTime​(String columnName)
      Returns an int representing the LocalTime from this Row at the column of the given name.
      int getRowNumber()
      Returns the zero-based index of the current position of this Row
      short getShort​(int columnIndex)
      Returns a short value from this Row at the column with the given index.
      short getShort​(String columnName)
      Returns a short from this Row at the column of the given name.
      String getString​(int columnIndex)
      Returns a String value from this Row at the column with the given index.
      String getString​(String columnName)
      Returns a String from this Row at the column of the given name.
      LocalTime getTime​(int columnIndex)
      Returns a LocalTime value from this Row at the column with the given index.
      LocalTime getTime​(String columnName)
      Returns a LocalTime value from this Row at the column of the given name.
      int hashCode()
      Returns a hash computed on the values in the backing table at this row
      boolean hasNext()
      Returns true if there's at least one more row beyond the current one.
      boolean isMissing​(String columnName)
      Returns true if the value at columnName is missing, and false otherwise
      Row next()
      Increments the row pointer, making the next row's data accessible
      void setBoolean​(int columnIndex, boolean value)
      Sets the value of the column at the given index and this Row to the given value.
      void setBoolean​(String columnName, boolean value)
      Sets the value of the column with the given name at this Row to the given value.
      void setBooleanAsByte​(int columnIndex, byte value)  
      void setBooleanAsByte​(String columnName, byte value)  
      void setDate​(int columnIndex, LocalDate value)
      Sets the value of the column at the given index and this Row to the given value.
      void setDate​(String columnName, LocalDate value)
      Sets the value of the column with the given name at this Row to the given value.
      void setDateTime​(int columnIndex, LocalDateTime value)
      Sets the value of the column at the given index and this Row to the given value.
      void setDateTime​(String columnName, LocalDateTime value)
      Sets the value of the column with the given name at this Row to the given value.
      void setDouble​(int columnIndex, double value)
      Sets the value of the column at the given index and this Row to the given value.
      void setDouble​(String columnName, double value)
      Sets the value of the column with the given name at this Row to the given value.
      void setFloat​(int columnIndex, float value)
      Sets the value of the column at the given index and this Row to the given value.
      void setFloat​(String columnName, float value)
      Sets the value of the column with the given name at this Row to the given value.
      void setInstant​(int columnIndex, Instant value)
      Sets the value of the column at the given index and this Row to the given value.
      void setInstant​(String columnName, Instant value)
      Sets the value of the column with the given name at this Row to the given value.
      void setInt​(int columnIndex, int value)
      Sets the value of the column at the given index and this Row to the given value.
      void setInt​(String columnName, int value)
      Sets the value of the column with the given name at this Row to the given value.
      void setLong​(int columnIndex, long value)
      Sets the value of the column at the given index and this Row to the given value.
      void setLong​(String columnName, long value)
      Sets the value of the column with the given name at this Row to the given value.
      void setMissing​(int columnIndex)
      Sets the value of the given column at this Row to the appropriate missing-value indicator for the column type.
      void setMissing​(String columnName)
      Sets the value of the given column at this Row to the appropriate missing-value indicator for the column type.
      void setPackedDate​(int columnIndex, int value)  
      void setPackedDate​(String columnName, int value)  
      void setPackedDateTime​(int columnIndex, long value)  
      void setPackedDateTime​(String columnName, long value)  
      void setPackedInstant​(int columnIndex, long value)  
      void setPackedInstant​(String columnName, long value)  
      void setPackedTime​(int columnIndex, int value)  
      void setPackedTime​(String columnName, int value)  
      void setShort​(int columnIndex, short value)
      Sets the value of the column at the given index and this Row to the given value.
      void setShort​(String columnName, short value)
      Sets the value of the column with the given name at this Row to the given value.
      void setString​(int columnIndex, String value)
      Sets the value of the column at the given index and this Row to the given value.
      void setString​(String columnName, String value)
      Sets the value of the column with the given name at this Row to the given value.
      void setTime​(int columnIndex, LocalTime value)
      Sets the value of the column at the given index and this Row to the given value.
      void setTime​(String columnName, LocalTime value)
      Sets the value of the column with the given name at this Row to the given value.
      String toString()  
      ColumnType type​(int columnIndex)  
    • Constructor Detail

      • Row

        public Row​(Table table)
        Constructs a Row object for the given table
      • Row

        public Row​(TableSlice tableSlice)
        Constructs a Row object for the given TableSlice
      • Row

        public Row​(Table table,
                   int rowNumber)
        Constructs a Row object for the given Table, with the Row positioned at the given 0-based index
      • Row

        public Row​(TableSlice tableSlice,
                   int rowNumber)
        Constructs a Row object for the given TableSlice, with the Row positioned at the given 0-based index
    • Method Detail

      • type

        public ColumnType type​(int columnIndex)
      • at

        public void at​(int rowNumber)
        Moves this Row to the given 0-based row index
      • columnCount

        public int columnCount()
        Returns the number of columns in this Row
      • columnNames

        public List<String> columnNames()
        Returns a list containing the names of each column in the row
      • getBoolean

        public Boolean getBoolean​(int columnIndex)
        Returns a Boolean value from this Row at the given column index.
      • getBooleanAsByte

        public byte getBooleanAsByte​(int columnIndex)
        Returns an element from a Boolean column in its internal byte form, avoiding boxing
      • getBooleanAsByte

        public byte getBooleanAsByte​(String columnName)
        Returns an element from a Boolean column in its internal byte form, avoiding boxing
      • getBoolean

        public Boolean getBoolean​(String columnName)
        Returns a Boolean value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an * IllegalArgumentException is thrown if the column has a different type
      • getDate

        public LocalDate getDate​(String columnName)
        Returns a LocalDate value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if the column has a different type
      • getDate

        public LocalDate getDate​(int columnIndex)
        Returns a LocalDate value from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if the column has a different type
      • getDateTime

        public LocalDateTime getDateTime​(int columnIndex)
        Returns a LocalDateTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getDateTime

        public LocalDateTime getDateTime​(String columnName)
        Returns a LocalDateTime value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getInstant

        public Instant getInstant​(int columnIndex)
        Returns an Instant from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getInstant

        public Instant getInstant​(String columnName)
        Returns an Instant value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getDouble

        public double getDouble​(int columnIndex)
        Returns a double from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getDouble

        public double getDouble​(String columnName)
        Returns a double from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getFloat

        public float getFloat​(int columnIndex)
        Returns a float from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getFloat

        public float getFloat​(String columnName)
        Returns a float from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getInt

        public int getInt​(int columnIndex)
        Returns an int from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getInt

        public int getInt​(String columnName)
        Returns an int from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getLong

        public long getLong​(int columnIndex)
        Returns a long from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getLong

        public long getLong​(String columnName)
        Returns a long from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getObject

        public Object getObject​(String columnName)
        Returns an Object representing the value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row.
      • getObject

        public Object getObject​(int columnIndex)
        Returns an Object representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row
      • getPackedDate

        public int getPackedDate​(String columnName)
        Returns an int representing the LocalDate from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getPackedDate

        public int getPackedDate​(int columnIndex)
        Returns an int representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type
      • getPackedInstant

        public long getPackedInstant​(int columnIndex)
        Returns an long representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type
      • getPackedInstant

        public long getPackedInstant​(String columnName)
        Returns a long representing the Instant from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getPackedDateTime

        public long getPackedDateTime​(String columnName)
        Returns a long representing the LocalDateTime from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getPackedDateTime

        public long getPackedDateTime​(int columnIndex)
        Returns an long representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type
      • getPackedTime

        public int getPackedTime​(String columnName)
        Returns an int representing the LocalTime from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getPackedTime

        public int getPackedTime​(int columnIndex)
        Returns an int representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type
      • getShort

        public short getShort​(int columnIndex)
        Returns a short value from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type
      • getRowNumber

        public int getRowNumber()
        Returns the zero-based index of the current position of this Row
      • getString

        public String getString​(int columnIndex)
        Returns a String value from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type
      • getShort

        public short getShort​(String columnName)
        Returns a short from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • getTime

        public LocalTime getTime​(String columnName)
        Returns a LocalTime value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type
      • getTime

        public LocalTime getTime​(int columnIndex)
        Returns a LocalTime value from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type
      • getString

        public String getString​(String columnName)
        Returns a String from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type
      • isMissing

        public boolean isMissing​(String columnName)
        Returns true if the value at columnName is missing, and false otherwise
      • hasNext

        public boolean hasNext()
        Returns true if there's at least one more row beyond the current one.
        Specified by:
        hasNext in interface Iterator<Row>
      • next

        public Row next()
        Increments the row pointer, making the next row's data accessible
        Specified by:
        next in interface Iterator<Row>
      • setMissing

        public void setMissing​(int columnIndex)
        Sets the value of the given column at this Row to the appropriate missing-value indicator for the column type.
      • setMissing

        public void setMissing​(String columnName)
        Sets the value of the given column at this Row to the appropriate missing-value indicator for the column type.
      • setBoolean

        public void setBoolean​(int columnIndex,
                               boolean value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setBoolean

        public void setBoolean​(String columnName,
                               boolean value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setDate

        public void setDate​(int columnIndex,
                            LocalDate value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setPackedDate

        public void setPackedDate​(int columnIndex,
                                  int value)
      • setDate

        public void setDate​(String columnName,
                            LocalDate value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setPackedDate

        public void setPackedDate​(String columnName,
                                  int value)
      • setPackedTime

        public void setPackedTime​(int columnIndex,
                                  int value)
      • setPackedDateTime

        public void setPackedDateTime​(int columnIndex,
                                      long value)
      • setPackedInstant

        public void setPackedInstant​(int columnIndex,
                                     long value)
      • setPackedTime

        public void setPackedTime​(String columnName,
                                  int value)
      • setPackedDateTime

        public void setPackedDateTime​(String columnName,
                                      long value)
      • setPackedInstant

        public void setPackedInstant​(String columnName,
                                     long value)
      • setBooleanAsByte

        public void setBooleanAsByte​(String columnName,
                                     byte value)
      • setBooleanAsByte

        public void setBooleanAsByte​(int columnIndex,
                                     byte value)
      • setDateTime

        public void setDateTime​(int columnIndex,
                                LocalDateTime value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setDateTime

        public void setDateTime​(String columnName,
                                LocalDateTime value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setInstant

        public void setInstant​(int columnIndex,
                               Instant value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setInstant

        public void setInstant​(String columnName,
                               Instant value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setDouble

        public void setDouble​(int columnIndex,
                              double value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setDouble

        public void setDouble​(String columnName,
                              double value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setFloat

        public void setFloat​(int columnIndex,
                             float value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setFloat

        public void setFloat​(String columnName,
                             float value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setInt

        public void setInt​(int columnIndex,
                           int value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setInt

        public void setInt​(String columnName,
                           int value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setLong

        public void setLong​(int columnIndex,
                            long value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setLong

        public void setLong​(String columnName,
                            long value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setShort

        public void setShort​(int columnIndex,
                             short value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setShort

        public void setShort​(String columnName,
                             short value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setString

        public void setString​(int columnIndex,
                              String value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setString

        public void setString​(String columnName,
                              String value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • setTime

        public void setTime​(int columnIndex,
                            LocalTime value)
        Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
      • getBackingRowNumber

        public int getBackingRowNumber()
        Returns the row number in the table backing the slice behind this row. This value may differ from the rowNumber() if the slice covers less than the entire table
      • getNumber

        public double getNumber​(String columnName)
        Returns a double representing the value held in the column with the given name at this row, for any numeric column type
      • getColumnType

        public ColumnType getColumnType​(String columnName)
        Returns the type of the named column
      • getColumnType

        public ColumnType getColumnType​(int columnIndex)
      • column

        public Column<?> column​(int columnIndex)
      • equals

        public boolean equals​(Object obj)
        Returns true if every value is equal to the corresponding value in the given row
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Returns a hash computed on the values in the backing table at this row
        Overrides:
        hashCode in class Object
      • setTime

        public void setTime​(String columnName,
                            LocalTime value)
        Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature