Interface StructReader

All Known Subinterfaces:
ResultSet, Struct

public interface StructReader
An interface for reading the columns of a Struct or com.google.cloud.bigtable.data.v2.models.sql.ResultSet.

This provides accessors for each valid type in the form of getTypeName(). Attempting to call these methods for a column of another type will result in an IllegalStateException. Each method has an overload accepting both int column index and String column Name. Attempting to call an index-based method with a non-existent index will result in an IndexOutOfBoundsException. Attempting to call a columnName based getter with a column name that does not appear exactly once in the set of fields will result in an IllegalArgumentException. Attempting to access a column with a null value will result in a NullPointerException; isNull(int) & isNull(String) can be used to check for null values.

  • Method Details

    • isNull

      boolean isNull(int columnIndex)
      Parameters:
      columnIndex - index of the column
      Returns:
      true if the column contains a NULL value
    • isNull

      boolean isNull(String columnName)
      Parameters:
      columnName - name of the column
      Returns:
      true if the column contains a NULL value
      Throws:
      IllegalArgumentException - if there is not exactly one column with the given name
    • getBytes

      com.google.protobuf.ByteString getBytes(int columnIndex)
      Parameters:
      columnIndex - index of the column
      Returns:
      ByteString type value of a non-NULL column
    • getBytes

      com.google.protobuf.ByteString getBytes(String columnName)
      Parameters:
      columnName - name of the column
      Returns:
      ByteString type value of a non-NULL column
    • getString

      String getString(int columnIndex)
      Parameters:
      columnIndex - index of the column
      Returns:
      String type value of a non-NULL column
    • getString

      String getString(String columnName)
      Parameters:
      columnName - name of the column
      Returns:
      String type value of a non-NULL column
    • getLong

      long getLong(int columnIndex)
      Parameters:
      columnIndex - index of the column
      Returns:
      long type value of a non-NULL column
    • getLong

      long getLong(String columnName)
      Parameters:
      columnName - name of the column
      Returns:
      long type value of a non-NULL column
    • getDouble

      double getDouble(int columnIndex)
      Getter for FLOAT_64 type Sql data
      Parameters:
      columnIndex - index of the column
      Returns:
      double type value of a non-NULL column
    • getDouble

      double getDouble(String columnName)
      Getter for FLOAT_64 type Sql data
      Parameters:
      columnName - name of the column
      Returns:
      double type value of a non-NULL column
    • getFloat

      float getFloat(int columnIndex)
      Getter for FLOAT_32 type Sql data
      Parameters:
      columnIndex - index of the column
      Returns:
      float type value of a non-NULL column
    • getFloat

      float getFloat(String columnName)
      Getter for FLOAT_32 type Sql data
      Parameters:
      columnName - name of the column
      Returns:
      float type value of a non-NULL column
    • getBoolean

      boolean getBoolean(int columnIndex)
      Parameters:
      columnIndex - index of the column
      Returns:
      boolean type value of a non-NULL column
    • getBoolean

      boolean getBoolean(String columnName)
      Parameters:
      columnName - name of the column
      Returns:
      boolean type value of a non-NULL column
    • getTimestamp

      Instant getTimestamp(int columnIndex)
      Parameters:
      columnIndex - index of the column
      Returns:
      Instant type value of a non-NULL column
    • getTimestamp

      Instant getTimestamp(String columnName)
      Parameters:
      columnName - name of the column
      Returns:
      Instant type value of a non-NULL column
    • getDate

      com.google.cloud.Date getDate(int columnIndex)
      Parameters:
      columnIndex - index of the column
      Returns:
      Date type value of a non-NULL column
    • getDate

      com.google.cloud.Date getDate(String columnName)
      Parameters:
      columnName - name of the column
      Returns:
      Date type value of a non-NULL column
    • getStruct

      Struct getStruct(int columnIndex)
      Parameters:
      columnIndex - index of the column
      Returns:
      Struct type value of a non- NULL column
    • getStruct

      Struct getStruct(String columnName)
      Parameters:
      columnName - name of the column
      Returns:
      Struct type value of a non- NULL column
    • getList

      <ElemType> List<ElemType> getList(int columnIndex, SqlType.Array<ElemType> arrayType)
      Type Parameters:
      ElemType - Java type of the list elements
      Parameters:
      columnIndex - index of the column
      Returns:
      List type value of a non-NULL column
    • getList

      <ElemType> List<ElemType> getList(String columnName, SqlType.Array<ElemType> arrayType)
      Type Parameters:
      ElemType - Java type of the list elements
      Parameters:
      columnName - name of the column
      Returns:
      List type value of a non-NULL column
    • getMap

      <K, V> Map<K,V> getMap(int columnIndex, SqlType.Map<K,V> mapType)
      Type Parameters:
      K - Java type of the map keys
      V - Java type of the map values
      Parameters:
      columnIndex - index of the column
      Returns:
      Map type value of a non-NULL column
    • getMap

      <K, V> Map<K,V> getMap(String columnName, SqlType.Map<K,V> mapType)
      Type Parameters:
      K - Java type of the map keys
      V - Java type of the map values
      Parameters:
      columnName - name of the column
      Returns:
      Map type value of a non-NULL column