Package com.google.cloud.spanner
Class ForwardingStructReader
java.lang.Object
com.google.cloud.spanner.ForwardingStructReader
- All Implemented Interfaces:
StructReader
- Direct Known Subclasses:
ForwardingResultSet
Forwarding implements of StructReader
-
Constructor Summary
ConstructorDescriptionForwardingStructReader
(StructReader delegate) ForwardingStructReader
(com.google.common.base.Supplier<? extends StructReader> delegate) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Called before each forwarding call to allow sub classes to do additional state checking.getBigDecimal
(int columnIndex) getBigDecimal
(String columnName) getBigDecimalList
(int columnIndex) getBigDecimalList
(String columnName) boolean
getBoolean
(int columnIndex) boolean
getBoolean
(String columnName) boolean[]
getBooleanArray
(int columnIndex) boolean[]
getBooleanArray
(String columnName) getBooleanList
(int columnIndex) getBooleanList
(String columnName) com.google.cloud.ByteArray
getBytes
(int columnIndex) com.google.cloud.ByteArray
List<com.google.cloud.ByteArray>
getBytesList
(int columnIndex) List<com.google.cloud.ByteArray>
getBytesList
(String columnName) int
int
getColumnIndex
(String columnName) getColumnType
(int columnIndex) getColumnType
(String columnName) com.google.cloud.Date
getDate
(int columnIndex) com.google.cloud.Date
List<com.google.cloud.Date>
getDateList
(int columnIndex) List<com.google.cloud.Date>
getDateList
(String columnName) double
getDouble
(int columnIndex) double
double[]
getDoubleArray
(int columnIndex) double[]
getDoubleArray
(String columnName) getDoubleList
(int columnIndex) getDoubleList
(String columnName) getJson
(int columnIndex) getJsonList
(int columnIndex) getJsonList
(String columnName) long
getLong
(int columnIndex) long
long[]
getLongArray
(int columnIndex) long[]
getLongArray
(String columnName) getLongList
(int columnIndex) getLongList
(String columnName) getPgJsonb
(int columnIndex) getPgJsonb
(String columnName) getPgJsonbList
(int columnIndex) getPgJsonbList
(String columnName) getString
(int columnIndex) getStringList
(int columnIndex) getStringList
(String columnName) getStructList
(int columnIndex) getStructList
(String columnName) com.google.cloud.Timestamp
getTimestamp
(int columnIndex) com.google.cloud.Timestamp
getTimestamp
(String columnName) List<com.google.cloud.Timestamp>
getTimestampList
(int columnIndex) List<com.google.cloud.Timestamp>
getTimestampList
(String columnName) getType()
getValue
(int columnIndex) boolean
isNull
(int columnIndex) boolean
-
Constructor Details
-
ForwardingStructReader
-
ForwardingStructReader
-
-
Method Details
-
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
- Specified by:
getType
in interfaceStructReader
- 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 theread()
call or named in the query text, in order.
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceStructReader
- Returns:
- the number of columns in the underlying data. This includes any columns with
NULL
values.
-
getColumnIndex
- Specified by:
getColumnIndex
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the index of the column named
columnName
.
-
getColumnType
- Specified by:
getColumnType
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the type of a column.
-
getColumnType
- Specified by:
getColumnType
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the type of a column.
-
isNull
public boolean isNull(int columnIndex) - Specified by:
isNull
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
true
if a column contains aNULL
value.
-
isNull
- Specified by:
isNull
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
true
if a column contains aNULL
value.
-
getBoolean
public boolean getBoolean(int columnIndex) - Specified by:
getBoolean
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.bool()
.
-
getBoolean
- Specified by:
getBoolean
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.bool()
.
-
getLong
public long getLong(int columnIndex) - Specified by:
getLong
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.int64()
.
-
getLong
- Specified by:
getLong
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.int64()
.
-
getDouble
public double getDouble(int columnIndex) - Specified by:
getDouble
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.float64()
.
-
getDouble
- Specified by:
getDouble
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.float64()
.
-
getBigDecimal
- Specified by:
getBigDecimal
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.numeric()
.
-
getBigDecimal
- Specified by:
getBigDecimal
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.numeric()
.
-
getString
- Specified by:
getString
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.string()
.
-
getString
- Specified by:
getString
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.string()
.
-
getJson
- Specified by:
getJson
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.json()
.
-
getJson
- Specified by:
getJson
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.json()
.
-
getPgJsonb
- Specified by:
getPgJsonb
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.pgJsonb()
.
-
getPgJsonb
- Specified by:
getPgJsonb
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.pgJsonb()
.
-
getBytes
public com.google.cloud.ByteArray getBytes(int columnIndex) - Specified by:
getBytes
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.bytes()
.
-
getBytes
- Specified by:
getBytes
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.bytes()
.
-
getTimestamp
public com.google.cloud.Timestamp getTimestamp(int columnIndex) - Specified by:
getTimestamp
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.timestamp()
.
-
getTimestamp
- Specified by:
getTimestamp
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.timestamp()
.
-
getDate
public com.google.cloud.Date getDate(int columnIndex) - Specified by:
getDate
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.date()
.
-
getDate
- Specified by:
getDate
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.date()
.
-
getBooleanArray
public boolean[] getBooleanArray(int columnIndex) - Specified by:
getBooleanArray
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.array(Type.bool())
.
-
getBooleanArray
- Specified by:
getBooleanArray
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.array(Type.bool())
.
-
getBooleanList
- Specified by:
getBooleanList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getBooleanList
- Specified by:
getBooleanList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getLongArray
public long[] getLongArray(int columnIndex) - Specified by:
getLongArray
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.array(Type.int64())
.
-
getLongArray
- Specified by:
getLongArray
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.array(Type.int64())
.
-
getLongList
- Specified by:
getLongList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getLongList
- Specified by:
getLongList
in interfaceStructReader
- 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.
-
getDoubleArray
public double[] getDoubleArray(int columnIndex) - Specified by:
getDoubleArray
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.array(Type.float64())
.
-
getDoubleArray
- Specified by:
getDoubleArray
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.array(Type.float64())
.
-
getDoubleList
- Specified by:
getDoubleList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getDoubleList
- Specified by:
getDoubleList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getBigDecimalList
- Specified by:
getBigDecimalList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getBigDecimalList
- Specified by:
getBigDecimalList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getStringList
- Specified by:
getStringList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getStringList
- Specified by:
getStringList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getJsonList
- Specified by:
getJsonList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getJsonList
- Specified by:
getJsonList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getPgJsonbList
- Specified by:
getPgJsonbList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getPgJsonbList
- Specified by:
getPgJsonbList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getBytesList
- Specified by:
getBytesList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getBytesList
- Specified by:
getBytesList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getTimestampList
- Specified by:
getTimestampList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getTimestampList
- Specified by:
getTimestampList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getDateList
- Specified by:
getDateList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getDateList
- Specified by:
getDateList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getStructList
- Specified by:
getStructList
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- 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.
-
getStructList
- Specified by:
getStructList
in interfaceStructReader
- Parameters:
columnName
- name of the column- 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.
-
getValue
- Specified by:
getValue
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a nullable column as a
Value
.
-
getValue
- Specified by:
getValue
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a nullable column as a
Value
.
-