Class ForwardingStructReader

java.lang.Object
com.google.cloud.spanner.ForwardingStructReader
All Implemented Interfaces:
StructReader
Direct Known Subclasses:
ForwardingResultSet

public class ForwardingStructReader extends Object implements StructReader
Forwarding implements of StructReader
  • Constructor Details

    • ForwardingStructReader

      public ForwardingStructReader(StructReader delegate)
    • ForwardingStructReader

      public ForwardingStructReader(com.google.common.base.Supplier<? extends StructReader> delegate)
  • Method Details

    • checkValidState

      protected void checkValidState()
      Called before each forwarding call to allow sub classes to do additional state checking. Sub classes should throw an Exception if the current state is not valid for reading data from this ForwardingStructReader. The default implementation does nothing.
    • getType

      public Type getType()
      Specified by:
      getType in interface StructReader
      Returns:
      the type of the underlying data. This will always be a STRUCT type, with fields corresponding to the data's columns. For the result of a read or query, this will always match the columns passed to the read() call or named in the query text, in order.
    • getColumnCount

      public int getColumnCount()
      Specified by:
      getColumnCount in interface StructReader
      Returns:
      the number of columns in the underlying data. This includes any columns with NULL values.
    • getColumnIndex

      public int getColumnIndex(String columnName)
      Specified by:
      getColumnIndex in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the index of the column named columnName.
    • getColumnType

      public Type getColumnType(int columnIndex)
      Specified by:
      getColumnType in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the type of a column.
    • getColumnType

      public Type getColumnType(String columnName)
      Specified by:
      getColumnType in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the type of a column.
    • isNull

      public boolean isNull(int columnIndex)
      Specified by:
      isNull in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      true if a column contains a NULL value.
    • isNull

      public boolean isNull(String columnName)
      Specified by:
      isNull in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      true if a column contains a NULL value.
    • getBoolean

      public boolean getBoolean(int columnIndex)
      Specified by:
      getBoolean in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.bool().
    • getBoolean

      public boolean getBoolean(String columnName)
      Specified by:
      getBoolean in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.bool().
    • getLong

      public long getLong(int columnIndex)
      Specified by:
      getLong in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.int64().
    • getLong

      public long getLong(String columnName)
      Specified by:
      getLong in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.int64().
    • getDouble

      public double getDouble(int columnIndex)
      Specified by:
      getDouble in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.float64().
    • getDouble

      public double getDouble(String columnName)
      Specified by:
      getDouble in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.float64().
    • getBigDecimal

      public BigDecimal getBigDecimal(int columnIndex)
      Specified by:
      getBigDecimal in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.numeric().
    • getBigDecimal

      public BigDecimal getBigDecimal(String columnName)
      Specified by:
      getBigDecimal in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.numeric().
    • getString

      public String getString(int columnIndex)
      Specified by:
      getString in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.string().
    • getString

      public String getString(String columnName)
      Specified by:
      getString in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.string().
    • getJson

      public String getJson(int columnIndex)
      Specified by:
      getJson in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.json().
    • getJson

      public String getJson(String columnName)
      Specified by:
      getJson in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.json().
    • getPgJsonb

      public String getPgJsonb(int columnIndex)
      Specified by:
      getPgJsonb in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.pgJsonb().
    • getPgJsonb

      public String getPgJsonb(String columnName)
      Specified by:
      getPgJsonb in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.pgJsonb().
    • getBytes

      public com.google.cloud.ByteArray getBytes(int columnIndex)
      Specified by:
      getBytes in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.bytes().
    • getBytes

      public com.google.cloud.ByteArray getBytes(String columnName)
      Specified by:
      getBytes in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.bytes().
    • getTimestamp

      public com.google.cloud.Timestamp getTimestamp(int columnIndex)
      Specified by:
      getTimestamp in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.timestamp().
    • getTimestamp

      public com.google.cloud.Timestamp getTimestamp(String columnName)
      Specified by:
      getTimestamp in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.timestamp().
    • getDate

      public com.google.cloud.Date getDate(int columnIndex)
      Specified by:
      getDate in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.date().
    • getDate

      public com.google.cloud.Date getDate(String columnName)
      Specified by:
      getDate in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.date().
    • getBooleanArray

      public boolean[] getBooleanArray(int columnIndex)
      Specified by:
      getBooleanArray in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.bool()).
    • getBooleanArray

      public boolean[] getBooleanArray(String columnName)
      Specified by:
      getBooleanArray in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.bool()).
    • getBooleanList

      public List<Boolean> getBooleanList(int columnIndex)
      Specified by:
      getBooleanList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.bool()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getBooleanList

      public List<Boolean> getBooleanList(String columnName)
      Specified by:
      getBooleanList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.bool()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getLongArray

      public long[] getLongArray(int columnIndex)
      Specified by:
      getLongArray in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.int64()).
    • getLongArray

      public long[] getLongArray(String columnName)
      Specified by:
      getLongArray in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.int64()).
    • getLongList

      public List<Long> getLongList(int columnIndex)
      Specified by:
      getLongList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.int64()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getLongList

      public List<Long> getLongList(String columnName)
      Specified by:
      getLongList in interface StructReader
      Returns:
      the value of a non-NULL column with type Type.array(Type.int64()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getDoubleArray

      public double[] getDoubleArray(int columnIndex)
      Specified by:
      getDoubleArray in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.float64()).
    • getDoubleArray

      public double[] getDoubleArray(String columnName)
      Specified by:
      getDoubleArray in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.float64()).
    • getDoubleList

      public List<Double> getDoubleList(int columnIndex)
      Specified by:
      getDoubleList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.float64()) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getDoubleList

      public List<Double> getDoubleList(String columnName)
      Specified by:
      getDoubleList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.float64()) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getBigDecimalList

      public List<BigDecimal> getBigDecimalList(int columnIndex)
      Specified by:
      getBigDecimalList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.numeric()) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getBigDecimalList

      public List<BigDecimal> getBigDecimalList(String columnName)
      Specified by:
      getBigDecimalList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.numeric()) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getStringList

      public List<String> getStringList(int columnIndex)
      Specified by:
      getStringList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.string()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getStringList

      public List<String> getStringList(String columnName)
      Specified by:
      getStringList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.string()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getJsonList

      public List<String> getJsonList(int columnIndex)
      Specified by:
      getJsonList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.json()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getJsonList

      public List<String> getJsonList(String columnName)
      Specified by:
      getJsonList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.json()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getPgJsonbList

      public List<String> getPgJsonbList(int columnIndex)
      Specified by:
      getPgJsonbList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.pgJsonb()) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getPgJsonbList

      public List<String> getPgJsonbList(String columnName)
      Specified by:
      getPgJsonbList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.pgJsonb()) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getBytesList

      public List<com.google.cloud.ByteArray> getBytesList(int columnIndex)
      Specified by:
      getBytesList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.bytes()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getBytesList

      public List<com.google.cloud.ByteArray> getBytesList(String columnName)
      Specified by:
      getBytesList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.bytes()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getTimestampList

      public List<com.google.cloud.Timestamp> getTimestampList(int columnIndex)
      Specified by:
      getTimestampList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.timestamp()) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getTimestampList

      public List<com.google.cloud.Timestamp> getTimestampList(String columnName)
      Specified by:
      getTimestampList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.timestamp()) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getDateList

      public List<com.google.cloud.Date> getDateList(int columnIndex)
      Specified by:
      getDateList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.date()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getDateList

      public List<com.google.cloud.Date> getDateList(String columnName)
      Specified by:
      getDateList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.date()). The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getStructList

      public List<Struct> getStructList(int columnIndex)
      Specified by:
      getStructList in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.struct(...)) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getStructList

      public List<Struct> getStructList(String columnName)
      Specified by:
      getStructList in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a non-NULL column with type Type.array(Type.struct(...)) The list returned by this method is lazily constructed. Create a copy of it if you intend to access each element in the list multiple times.
    • getValue

      public Value getValue(int columnIndex)
      Specified by:
      getValue in interface StructReader
      Parameters:
      columnIndex - index of the column
      Returns:
      the value of a nullable column as a Value.
    • getValue

      public Value getValue(String columnName)
      Specified by:
      getValue in interface StructReader
      Parameters:
      columnName - name of the column
      Returns:
      the value of a nullable column as a Value.