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 void
checkValidState()
Called before each forwarding call to allow sub classes to do additional state checking.BigDecimal
getBigDecimal(int columnIndex)
Returns the value of a non-NULL
column with typeType.numeric()
.BigDecimal
getBigDecimal(String columnName)
Returns the value of a non-NULL
column with typeType.numeric()
.List<BigDecimal>
getBigDecimalList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.numeric())
The list returned by this method is lazily constructed.List<BigDecimal>
getBigDecimalList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.numeric())
The list returned by this method is lazily constructed.boolean
getBoolean(int columnIndex)
Returns the value of a non-NULL
column with typeType.bool()
.boolean
getBoolean(String columnName)
Returns the value of a non-NULL
column with typeType.bool()
.boolean[]
getBooleanArray(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.bool())
.boolean[]
getBooleanArray(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.bool())
.List<Boolean>
getBooleanList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.bool())
.List<Boolean>
getBooleanList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.bool())
.com.google.cloud.ByteArray
getBytes(int columnIndex)
Returns the value of a non-NULL
column with typeType.bytes()
.com.google.cloud.ByteArray
getBytes(String columnName)
Returns the value of a non-NULL
column with typeType.bytes()
.List<com.google.cloud.ByteArray>
getBytesList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.bytes())
.List<com.google.cloud.ByteArray>
getBytesList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.bytes())
.int
getColumnCount()
Returns the number of columns in the underlying data.int
getColumnIndex(String columnName)
Returns the index of the column namedcolumnName
.Type
getColumnType(int columnIndex)
Returns the type of a column.Type
getColumnType(String columnName)
Returns the type of a column.com.google.cloud.Date
getDate(int columnIndex)
Returns the value of a non-NULL
column with typeType.date()
.com.google.cloud.Date
getDate(String columnName)
Returns the value of a non-NULL
column with typeType.date()
.List<com.google.cloud.Date>
getDateList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.date())
.List<com.google.cloud.Date>
getDateList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.date())
.double
getDouble(int columnIndex)
Returns the value of a non-NULL
column with typeType.float64()
.double
getDouble(String columnName)
Returns the value of a non-NULL
column with typeType.float64()
.double[]
getDoubleArray(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.float64())
.double[]
getDoubleArray(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.float64())
.List<Double>
getDoubleList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.float64())
The list returned by this method is lazily constructed.List<Double>
getDoubleList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.float64())
The list returned by this method is lazily constructed.String
getJson(int columnIndex)
Returns the value of a non-NULL
column with typeType.json()
.String
getJson(String columnName)
Returns the value of a non-NULL
column with typeType.json()
.List<String>
getJsonList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.json())
.List<String>
getJsonList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.json())
.long
getLong(int columnIndex)
Returns the value of a non-NULL
column with typeType.int64()
.long
getLong(String columnName)
Returns the value of a non-NULL
column with typeType.int64()
.long[]
getLongArray(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.int64())
.long[]
getLongArray(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.int64())
.List<Long>
getLongList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.int64())
.List<Long>
getLongList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.int64())
.String
getPgJsonb(int columnIndex)
Returns the value of a non-NULL
column with typeType.pgJsonb()
.String
getPgJsonb(String columnName)
Returns the value of a non-NULL
column with typeType.pgJsonb()
.List<String>
getPgJsonbList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.pgJsonb())
The list returned by this method is lazily constructed.List<String>
getPgJsonbList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.pgJsonb())
The list returned by this method is lazily constructed.String
getString(int columnIndex)
Returns the value of a non-NULL
column with typeType.string()
.String
getString(String columnName)
Returns the value of a non-NULL
column with typeType.string()
.List<String>
getStringList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.string())
.List<String>
getStringList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.string())
.List<Struct>
getStructList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.struct(...))
The list returned by this method is lazily constructed.List<Struct>
getStructList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.struct(...))
The list returned by this method is lazily constructed.com.google.cloud.Timestamp
getTimestamp(int columnIndex)
Returns the value of a non-NULL
column with typeType.timestamp()
.com.google.cloud.Timestamp
getTimestamp(String columnName)
Returns the value of a non-NULL
column with typeType.timestamp()
.List<com.google.cloud.Timestamp>
getTimestampList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.timestamp())
The list returned by this method is lazily constructed.List<com.google.cloud.Timestamp>
getTimestampList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.timestamp())
The list returned by this method is lazily constructed.Type
getType()
Returns the type of the underlying data.Value
getValue(int columnIndex)
Returns the value of a nullable column as aValue
.Value
getValue(String columnName)
Returns the value of a nullable column as aValue
.boolean
isNull(int columnIndex)
Returnstrue
if a column contains aNULL
value.boolean
isNull(String columnName)
Returnstrue
if a column contains aNULL
value.
-
-
-
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 anException
if the current state is not valid for reading data from thisForwardingStructReader
. The default implementation does nothing.
-
getType
public Type getType()
Description copied from interface:StructReader
Returns the type of the underlying data. This will always be aSTRUCT
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 theread()
call or named in the query text, in order.- Specified by:
getType
in interfaceStructReader
-
getColumnCount
public int getColumnCount()
Description copied from interface:StructReader
Returns the number of columns in the underlying data. This includes any columns withNULL
values.- Specified by:
getColumnCount
in interfaceStructReader
-
getColumnIndex
public int getColumnIndex(String columnName)
Description copied from interface:StructReader
Returns the index of the column namedcolumnName
.- Specified by:
getColumnIndex
in interfaceStructReader
-
getColumnType
public Type getColumnType(int columnIndex)
Description copied from interface:StructReader
Returns the type of a column.- Specified by:
getColumnType
in interfaceStructReader
-
getColumnType
public Type getColumnType(String columnName)
Description copied from interface:StructReader
Returns the type of a column.- Specified by:
getColumnType
in interfaceStructReader
-
isNull
public boolean isNull(int columnIndex)
Description copied from interface:StructReader
Returnstrue
if a column contains aNULL
value.- Specified by:
isNull
in interfaceStructReader
-
isNull
public boolean isNull(String columnName)
Description copied from interface:StructReader
Returnstrue
if a column contains aNULL
value.- Specified by:
isNull
in interfaceStructReader
-
getBoolean
public boolean getBoolean(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.bool()
.- Specified by:
getBoolean
in interfaceStructReader
-
getBoolean
public boolean getBoolean(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.bool()
.- Specified by:
getBoolean
in interfaceStructReader
-
getLong
public long getLong(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.int64()
.- Specified by:
getLong
in interfaceStructReader
-
getLong
public long getLong(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.int64()
.- Specified by:
getLong
in interfaceStructReader
-
getDouble
public double getDouble(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.float64()
.- Specified by:
getDouble
in interfaceStructReader
-
getDouble
public double getDouble(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.float64()
.- Specified by:
getDouble
in interfaceStructReader
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.numeric()
.- Specified by:
getBigDecimal
in interfaceStructReader
-
getBigDecimal
public BigDecimal getBigDecimal(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.numeric()
.- Specified by:
getBigDecimal
in interfaceStructReader
-
getString
public String getString(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.string()
.- Specified by:
getString
in interfaceStructReader
-
getString
public String getString(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.string()
.- Specified by:
getString
in interfaceStructReader
-
getJson
public String getJson(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.json()
.- Specified by:
getJson
in interfaceStructReader
-
getJson
public String getJson(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.json()
.- Specified by:
getJson
in interfaceStructReader
-
getPgJsonb
public String getPgJsonb(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.pgJsonb()
.- Specified by:
getPgJsonb
in interfaceStructReader
-
getPgJsonb
public String getPgJsonb(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.pgJsonb()
.- Specified by:
getPgJsonb
in interfaceStructReader
-
getBytes
public com.google.cloud.ByteArray getBytes(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.bytes()
.- Specified by:
getBytes
in interfaceStructReader
-
getBytes
public com.google.cloud.ByteArray getBytes(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.bytes()
.- Specified by:
getBytes
in interfaceStructReader
-
getTimestamp
public com.google.cloud.Timestamp getTimestamp(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.timestamp()
.- Specified by:
getTimestamp
in interfaceStructReader
-
getTimestamp
public com.google.cloud.Timestamp getTimestamp(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.timestamp()
.- Specified by:
getTimestamp
in interfaceStructReader
-
getDate
public com.google.cloud.Date getDate(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.date()
.- Specified by:
getDate
in interfaceStructReader
-
getDate
public com.google.cloud.Date getDate(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.date()
.- Specified by:
getDate
in interfaceStructReader
-
getBooleanArray
public boolean[] getBooleanArray(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.array(Type.bool())
.- Specified by:
getBooleanArray
in interfaceStructReader
-
getBooleanArray
public boolean[] getBooleanArray(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.array(Type.bool())
.- Specified by:
getBooleanArray
in interfaceStructReader
-
getBooleanList
public List<Boolean> getBooleanList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getBooleanList
in interfaceStructReader
-
getBooleanList
public List<Boolean> getBooleanList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getBooleanList
in interfaceStructReader
-
getLongArray
public long[] getLongArray(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.array(Type.int64())
.- Specified by:
getLongArray
in interfaceStructReader
-
getLongArray
public long[] getLongArray(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.array(Type.int64())
.- Specified by:
getLongArray
in interfaceStructReader
-
getLongList
public List<Long> getLongList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getLongList
in interfaceStructReader
-
getLongList
public List<Long> getLongList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getLongList
in interfaceStructReader
-
getDoubleArray
public double[] getDoubleArray(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.array(Type.float64())
.- Specified by:
getDoubleArray
in interfaceStructReader
-
getDoubleArray
public double[] getDoubleArray(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column with typeType.array(Type.float64())
.- Specified by:
getDoubleArray
in interfaceStructReader
-
getDoubleList
public List<Double> getDoubleList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getDoubleList
in interfaceStructReader
-
getDoubleList
public List<Double> getDoubleList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getDoubleList
in interfaceStructReader
-
getBigDecimalList
public List<BigDecimal> getBigDecimalList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getBigDecimalList
in interfaceStructReader
-
getBigDecimalList
public List<BigDecimal> getBigDecimalList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getBigDecimalList
in interfaceStructReader
-
getStringList
public List<String> getStringList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getStringList
in interfaceStructReader
-
getStringList
public List<String> getStringList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getStringList
in interfaceStructReader
-
getJsonList
public List<String> getJsonList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getJsonList
in interfaceStructReader
-
getJsonList
public List<String> getJsonList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getJsonList
in interfaceStructReader
-
getPgJsonbList
public List<String> getPgJsonbList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getPgJsonbList
in interfaceStructReader
-
getPgJsonbList
public List<String> getPgJsonbList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getPgJsonbList
in interfaceStructReader
-
getBytesList
public List<com.google.cloud.ByteArray> getBytesList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getBytesList
in interfaceStructReader
-
getBytesList
public List<com.google.cloud.ByteArray> getBytesList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getBytesList
in interfaceStructReader
-
getTimestampList
public List<com.google.cloud.Timestamp> getTimestampList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getTimestampList
in interfaceStructReader
-
getTimestampList
public List<com.google.cloud.Timestamp> getTimestampList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getTimestampList
in interfaceStructReader
-
getDateList
public List<com.google.cloud.Date> getDateList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getDateList
in interfaceStructReader
-
getDateList
public List<com.google.cloud.Date> getDateList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getDateList
in interfaceStructReader
-
getStructList
public List<Struct> getStructList(int columnIndex)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getStructList
in interfaceStructReader
-
getStructList
public List<Struct> getStructList(String columnName)
Description copied from interface:StructReader
Returns the value of a non-NULL
column 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.- Specified by:
getStructList
in interfaceStructReader
-
getValue
public Value getValue(int columnIndex)
Description copied from interface:StructReader
Returns the value of a nullable column as aValue
.- Specified by:
getValue
in interfaceStructReader
-
getValue
public Value getValue(String columnName)
Description copied from interface:StructReader
Returns the value of a nullable column as aValue
.- Specified by:
getValue
in interfaceStructReader
-
-