Package com.google.cloud.spanner
Class AbstractStructReader
- java.lang.Object
-
- com.google.cloud.spanner.AbstractStructReader
-
- All Implemented Interfaces:
StructReader
- Direct Known Subclasses:
Struct
public abstract class AbstractStructReader extends Object implements StructReader
Base class for assistingStructReader
implementations.This class implements the majority of the
StructReader
interface, leaving subclasses to implement core data access via thegetTypeNameInternal()
methods.AbstractStructReader
guarantees that these will only be called for non-NULL
columns of a type appropriate for the method.
-
-
Constructor Summary
Constructors Constructor Description AbstractStructReader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkNonNull(int columnIndex, Object columnNameForError)
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()
.protected abstract BigDecimal
getBigDecimalInternal(int columnIndex)
List<BigDecimal>
getBigDecimalList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.numeric())
.List<BigDecimal>
getBigDecimalList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.numeric())
.protected abstract List<BigDecimal>
getBigDecimalListInternal(int columnIndex)
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())
.protected abstract boolean[]
getBooleanArrayInternal(int columnIndex)
protected abstract boolean
getBooleanInternal(int columnIndex)
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())
.protected abstract List<Boolean>
getBooleanListInternal(int columnIndex)
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()
.protected abstract com.google.cloud.ByteArray
getBytesInternal(int columnIndex)
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())
.protected abstract List<com.google.cloud.ByteArray>
getBytesListInternal(int columnIndex)
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()
.protected abstract com.google.cloud.Date
getDateInternal(int columnIndex)
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())
.protected abstract List<com.google.cloud.Date>
getDateListInternal(int columnIndex)
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())
.protected abstract double[]
getDoubleArrayInternal(int columnIndex)
protected abstract double
getDoubleInternal(int columnIndex)
List<Double>
getDoubleList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.float64())
.List<Double>
getDoubleList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.float64())
.protected abstract List<Double>
getDoubleListInternal(int columnIndex)
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()
.protected String
getJsonInternal(int columnIndex)
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())
.protected List<String>
getJsonListInternal(int columnIndex)
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())
.protected abstract long[]
getLongArrayInternal(int columnIndex)
protected abstract long
getLongInternal(int columnIndex)
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())
.protected abstract List<Long>
getLongListInternal(int columnIndex)
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()
.protected String
getPgJsonbInternal(int columnIndex)
List<String>
getPgJsonbList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.pgJsonb())
.List<String>
getPgJsonbList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.pgJsonb())
.protected List<String>
getPgJsonbListInternal(int columnIndex)
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()
.protected abstract String
getStringInternal(int columnIndex)
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())
.protected abstract List<String>
getStringListInternal(int columnIndex)
List<Struct>
getStructList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.struct(...))
.List<Struct>
getStructList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.struct(...))
.protected abstract List<Struct>
getStructListInternal(int columnIndex)
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()
.protected abstract com.google.cloud.Timestamp
getTimestampInternal(int columnIndex)
List<com.google.cloud.Timestamp>
getTimestampList(int columnIndex)
Returns the value of a non-NULL
column with typeType.array(Type.timestamp())
.List<com.google.cloud.Timestamp>
getTimestampList(String columnName)
Returns the value of a non-NULL
column with typeType.array(Type.timestamp())
.protected abstract List<com.google.cloud.Timestamp>
getTimestampListInternal(int columnIndex)
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
.protected Value
getValueInternal(int columnIndex)
boolean
isNull(String columnName)
Returnstrue
if a column contains aNULL
value.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.cloud.spanner.StructReader
getType, isNull
-
-
-
-
Method Detail
-
getBooleanInternal
protected abstract boolean getBooleanInternal(int columnIndex)
-
getLongInternal
protected abstract long getLongInternal(int columnIndex)
-
getDoubleInternal
protected abstract double getDoubleInternal(int columnIndex)
-
getBigDecimalInternal
protected abstract BigDecimal getBigDecimalInternal(int columnIndex)
-
getStringInternal
protected abstract String getStringInternal(int columnIndex)
-
getJsonInternal
protected String getJsonInternal(int columnIndex)
-
getPgJsonbInternal
protected String getPgJsonbInternal(int columnIndex)
-
getBytesInternal
protected abstract com.google.cloud.ByteArray getBytesInternal(int columnIndex)
-
getTimestampInternal
protected abstract com.google.cloud.Timestamp getTimestampInternal(int columnIndex)
-
getDateInternal
protected abstract com.google.cloud.Date getDateInternal(int columnIndex)
-
getValueInternal
protected Value getValueInternal(int columnIndex)
-
getBooleanArrayInternal
protected abstract boolean[] getBooleanArrayInternal(int columnIndex)
-
getLongArrayInternal
protected abstract long[] getLongArrayInternal(int columnIndex)
-
getDoubleArrayInternal
protected abstract double[] getDoubleArrayInternal(int columnIndex)
-
getBigDecimalListInternal
protected abstract List<BigDecimal> getBigDecimalListInternal(int columnIndex)
-
getBytesListInternal
protected abstract List<com.google.cloud.ByteArray> getBytesListInternal(int columnIndex)
-
getTimestampListInternal
protected abstract List<com.google.cloud.Timestamp> getTimestampListInternal(int columnIndex)
-
getDateListInternal
protected abstract List<com.google.cloud.Date> getDateListInternal(int columnIndex)
-
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
-
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(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
-
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
-
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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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())
.- 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(...))
.- 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(...))
.- Specified by:
getStructList
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
-
checkNonNull
protected void checkNonNull(int columnIndex, Object columnNameForError)
-
-