Package com.google.cloud.spanner
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 Summary
Constructors Constructor Description ForwardingStructReader(StructReader delegate)ForwardingStructReader(com.google.common.base.Supplier<? extends StructReader> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckValidState()Called before each forwarding call to allow sub classes to do additional state checking.BigDecimalgetBigDecimal(int columnIndex)BigDecimalgetBigDecimal(String columnName)List<BigDecimal>getBigDecimalList(int columnIndex)List<BigDecimal>getBigDecimalList(String columnName)booleangetBoolean(int columnIndex)booleangetBoolean(String columnName)boolean[]getBooleanArray(int columnIndex)boolean[]getBooleanArray(String columnName)List<Boolean>getBooleanList(int columnIndex)List<Boolean>getBooleanList(String columnName)com.google.cloud.ByteArraygetBytes(int columnIndex)com.google.cloud.ByteArraygetBytes(String columnName)List<com.google.cloud.ByteArray>getBytesList(int columnIndex)List<com.google.cloud.ByteArray>getBytesList(String columnName)intgetColumnCount()intgetColumnIndex(String columnName)TypegetColumnType(int columnIndex)TypegetColumnType(String columnName)com.google.cloud.DategetDate(int columnIndex)com.google.cloud.DategetDate(String columnName)List<com.google.cloud.Date>getDateList(int columnIndex)List<com.google.cloud.Date>getDateList(String columnName)doublegetDouble(int columnIndex)doublegetDouble(String columnName)double[]getDoubleArray(int columnIndex)double[]getDoubleArray(String columnName)List<Double>getDoubleList(int columnIndex)List<Double>getDoubleList(String columnName)StringgetJson(int columnIndex)StringgetJson(String columnName)List<String>getJsonList(int columnIndex)List<String>getJsonList(String columnName)longgetLong(int columnIndex)longgetLong(String columnName)long[]getLongArray(int columnIndex)long[]getLongArray(String columnName)List<Long>getLongList(int columnIndex)List<Long>getLongList(String columnName)StringgetPgJsonb(int columnIndex)StringgetPgJsonb(String columnName)List<String>getPgJsonbList(int columnIndex)List<String>getPgJsonbList(String columnName)StringgetString(int columnIndex)StringgetString(String columnName)List<String>getStringList(int columnIndex)List<String>getStringList(String columnName)List<Struct>getStructList(int columnIndex)List<Struct>getStructList(String columnName)com.google.cloud.TimestampgetTimestamp(int columnIndex)com.google.cloud.TimestampgetTimestamp(String columnName)List<com.google.cloud.Timestamp>getTimestampList(int columnIndex)List<com.google.cloud.Timestamp>getTimestampList(String columnName)TypegetType()ValuegetValue(int columnIndex)ValuegetValue(String columnName)booleanisNull(int columnIndex)booleanisNull(String columnName)
-
-
-
Constructor Detail
-
ForwardingStructReader
public ForwardingStructReader(StructReader delegate)
-
ForwardingStructReader
public ForwardingStructReader(com.google.common.base.Supplier<? extends StructReader> delegate)
-
-
Method Detail
-
checkValidState
protected void checkValidState()
Called before each forwarding call to allow sub classes to do additional state checking. Sub classes should throw anExceptionif the current state is not valid for reading data from thisForwardingStructReader. The default implementation does nothing.
-
getType
public Type getType()
- Specified by:
getTypein interfaceStructReader- Returns:
- the type of the underlying data. This will always be a
STRUCTtype, with fields corresponding to the data's columns. For the result of a read or query, this will always match the columns passed to theread()call or named in the query text, in order.
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCountin interfaceStructReader- Returns:
- the number of columns in the underlying data. This includes any columns with
NULLvalues.
-
getColumnIndex
public int getColumnIndex(String columnName)
- Specified by:
getColumnIndexin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the index of the column named
columnName.
-
getColumnType
public Type getColumnType(int columnIndex)
- Specified by:
getColumnTypein interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the type of a column.
-
getColumnType
public Type getColumnType(String columnName)
- Specified by:
getColumnTypein interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the type of a column.
-
isNull
public boolean isNull(int columnIndex)
- Specified by:
isNullin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
trueif a column contains aNULLvalue.
-
isNull
public boolean isNull(String columnName)
- Specified by:
isNullin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
trueif a column contains aNULLvalue.
-
getBoolean
public boolean getBoolean(int columnIndex)
- Specified by:
getBooleanin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.bool().
-
getBoolean
public boolean getBoolean(String columnName)
- Specified by:
getBooleanin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.bool().
-
getLong
public long getLong(int columnIndex)
- Specified by:
getLongin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.int64().
-
getLong
public long getLong(String columnName)
- Specified by:
getLongin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.int64().
-
getDouble
public double getDouble(int columnIndex)
- Specified by:
getDoublein interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.float64().
-
getDouble
public double getDouble(String columnName)
- Specified by:
getDoublein interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.float64().
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex)
- Specified by:
getBigDecimalin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.numeric().
-
getBigDecimal
public BigDecimal getBigDecimal(String columnName)
- Specified by:
getBigDecimalin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.numeric().
-
getString
public String getString(int columnIndex)
- Specified by:
getStringin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.string().
-
getString
public String getString(String columnName)
- Specified by:
getStringin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.string().
-
getJson
public String getJson(int columnIndex)
- Specified by:
getJsonin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.json().
-
getJson
public String getJson(String columnName)
- Specified by:
getJsonin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.json().
-
getPgJsonb
public String getPgJsonb(int columnIndex)
- Specified by:
getPgJsonbin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.pgJsonb().
-
getPgJsonb
public String getPgJsonb(String columnName)
- Specified by:
getPgJsonbin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.pgJsonb().
-
getBytes
public com.google.cloud.ByteArray getBytes(int columnIndex)
- Specified by:
getBytesin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.bytes().
-
getBytes
public com.google.cloud.ByteArray getBytes(String columnName)
- Specified by:
getBytesin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.bytes().
-
getTimestamp
public com.google.cloud.Timestamp getTimestamp(int columnIndex)
- Specified by:
getTimestampin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.timestamp().
-
getTimestamp
public com.google.cloud.Timestamp getTimestamp(String columnName)
- Specified by:
getTimestampin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.timestamp().
-
getDate
public com.google.cloud.Date getDate(int columnIndex)
- Specified by:
getDatein interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.date().
-
getDate
public com.google.cloud.Date getDate(String columnName)
- Specified by:
getDatein interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.date().
-
getBooleanArray
public boolean[] getBooleanArray(int columnIndex)
- Specified by:
getBooleanArrayin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.array(Type.bool()).
-
getBooleanArray
public boolean[] getBooleanArray(String columnName)
- Specified by:
getBooleanArrayin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.array(Type.bool()).
-
getBooleanList
public List<Boolean> getBooleanList(int columnIndex)
- Specified by:
getBooleanListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getBooleanListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getLongArrayin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.array(Type.int64()).
-
getLongArray
public long[] getLongArray(String columnName)
- Specified by:
getLongArrayin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.array(Type.int64()).
-
getLongList
public List<Long> getLongList(int columnIndex)
- Specified by:
getLongListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getLongListin interfaceStructReader- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getDoubleArrayin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.array(Type.float64()).
-
getDoubleArray
public double[] getDoubleArray(String columnName)
- Specified by:
getDoubleArrayin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.array(Type.float64()).
-
getDoubleList
public List<Double> getDoubleList(int columnIndex)
- Specified by:
getDoubleListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getDoubleListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getBigDecimalListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getBigDecimalListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getStringListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getStringListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getJsonListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getJsonListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getPgJsonbListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getPgJsonbListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getBytesListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getBytesListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getTimestampListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getTimestampListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getDateListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getDateListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getStructListin interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getStructListin interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a non-
NULLcolumn with typeType.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:
getValuein interfaceStructReader- Parameters:
columnIndex- index of the column- Returns:
- the value of a nullable column as a
Value.
-
getValue
public Value getValue(String columnName)
- Specified by:
getValuein interfaceStructReader- Parameters:
columnName- name of the column- Returns:
- the value of a nullable column as a
Value.
-
-