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)
BigDecimal
getBigDecimal(String columnName)
List<BigDecimal>
getBigDecimalList(int columnIndex)
List<BigDecimal>
getBigDecimalList(String columnName)
boolean
getBoolean(int columnIndex)
boolean
getBoolean(String columnName)
boolean[]
getBooleanArray(int columnIndex)
boolean[]
getBooleanArray(String columnName)
List<Boolean>
getBooleanList(int columnIndex)
List<Boolean>
getBooleanList(String columnName)
com.google.cloud.ByteArray
getBytes(int columnIndex)
com.google.cloud.ByteArray
getBytes(String columnName)
List<com.google.cloud.ByteArray>
getBytesList(int columnIndex)
List<com.google.cloud.ByteArray>
getBytesList(String columnName)
int
getColumnCount()
int
getColumnIndex(String columnName)
Type
getColumnType(int columnIndex)
Type
getColumnType(String columnName)
com.google.cloud.Date
getDate(int columnIndex)
com.google.cloud.Date
getDate(String columnName)
List<com.google.cloud.Date>
getDateList(int columnIndex)
List<com.google.cloud.Date>
getDateList(String columnName)
double
getDouble(int columnIndex)
double
getDouble(String columnName)
double[]
getDoubleArray(int columnIndex)
double[]
getDoubleArray(String columnName)
List<Double>
getDoubleList(int columnIndex)
List<Double>
getDoubleList(String columnName)
String
getJson(int columnIndex)
String
getJson(String columnName)
List<String>
getJsonList(int columnIndex)
List<String>
getJsonList(String columnName)
long
getLong(int columnIndex)
long
getLong(String columnName)
long[]
getLongArray(int columnIndex)
long[]
getLongArray(String columnName)
List<Long>
getLongList(int columnIndex)
List<Long>
getLongList(String columnName)
String
getPgJsonb(int columnIndex)
String
getPgJsonb(String columnName)
List<String>
getPgJsonbList(int columnIndex)
List<String>
getPgJsonbList(String columnName)
String
getString(int columnIndex)
String
getString(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.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)
Type
getType()
Value
getValue(int columnIndex)
Value
getValue(String columnName)
boolean
isNull(int columnIndex)
boolean
isNull(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 anException
if the current state is not valid for reading data from thisForwardingStructReader
. The default implementation does nothing.
-
getType
public Type 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
public int getColumnIndex(String columnName)
- Specified by:
getColumnIndex
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the index of the column named
columnName
.
-
getColumnType
public Type getColumnType(int columnIndex)
- Specified by:
getColumnType
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the type of a column.
-
getColumnType
public Type getColumnType(String columnName)
- 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
public boolean isNull(String columnName)
- 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
public boolean getBoolean(String columnName)
- 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
public long getLong(String columnName)
- 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
public double getDouble(String columnName)
- Specified by:
getDouble
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.float64()
.
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex)
- Specified by:
getBigDecimal
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.numeric()
.
-
getBigDecimal
public BigDecimal getBigDecimal(String columnName)
- Specified by:
getBigDecimal
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.numeric()
.
-
getString
public String getString(int columnIndex)
- Specified by:
getString
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.string()
.
-
getString
public String getString(String columnName)
- Specified by:
getString
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.string()
.
-
getJson
public String getJson(int columnIndex)
- Specified by:
getJson
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.json()
.
-
getJson
public String getJson(String columnName)
- Specified by:
getJson
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a non-
NULL
column with typeType.json()
.
-
getPgJsonb
public String getPgJsonb(int columnIndex)
- Specified by:
getPgJsonb
in interfaceStructReader
- Parameters:
columnIndex
- index of the column- Returns:
- the value of a non-
NULL
column with typeType.pgJsonb()
.
-
getPgJsonb
public String getPgJsonb(String columnName)
- 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
public com.google.cloud.ByteArray getBytes(String columnName)
- 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
public com.google.cloud.Timestamp getTimestamp(String columnName)
- 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
public com.google.cloud.Date getDate(String columnName)
- 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
public boolean[] getBooleanArray(String columnName)
- 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
public List<Boolean> getBooleanList(int columnIndex)
- 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
public List<Boolean> getBooleanList(String columnName)
- 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
public long[] getLongArray(String columnName)
- 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
public List<Long> getLongList(int columnIndex)
- 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
public List<Long> getLongList(String columnName)
- 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
public double[] getDoubleArray(String columnName)
- 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
public List<Double> getDoubleList(int columnIndex)
- 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
public List<Double> getDoubleList(String columnName)
- 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
public List<BigDecimal> getBigDecimalList(int columnIndex)
- 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
public List<BigDecimal> getBigDecimalList(String columnName)
- 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
public List<String> getStringList(int columnIndex)
- 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
public List<String> getStringList(String columnName)
- 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
public List<String> getJsonList(int columnIndex)
- 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
public List<String> getJsonList(String columnName)
- 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
public List<String> getPgJsonbList(int columnIndex)
- 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
public List<String> getPgJsonbList(String columnName)
- 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
public List<com.google.cloud.ByteArray> getBytesList(int columnIndex)
- 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
public List<com.google.cloud.ByteArray> getBytesList(String columnName)
- 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
public List<com.google.cloud.Timestamp> getTimestampList(int columnIndex)
- 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
public List<com.google.cloud.Timestamp> getTimestampList(String columnName)
- 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
public List<com.google.cloud.Date> getDateList(int columnIndex)
- 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
public List<com.google.cloud.Date> getDateList(String columnName)
- 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
public List<Struct> getStructList(int columnIndex)
- 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
public List<Struct> getStructList(String columnName)
- 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
public Value getValue(int columnIndex)
- Specified by:
getValue
in 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:
getValue
in interfaceStructReader
- Parameters:
columnName
- name of the column- Returns:
- the value of a nullable column as a
Value
.
-
-