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 assistingStructReaderimplementations.This class implements the majority of the
StructReaderinterface, leaving subclasses to implement core data access via thegetTypeNameInternal()methods.AbstractStructReaderguarantees that these will only be called for non-NULLcolumns 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 voidcheckNonNull(int columnIndex, Object columnNameForError)BigDecimalgetBigDecimal(int columnIndex)Returns the value of a non-NULLcolumn with typeType.numeric().BigDecimalgetBigDecimal(String columnName)Returns the value of a non-NULLcolumn with typeType.numeric().protected abstract BigDecimalgetBigDecimalInternal(int columnIndex)List<BigDecimal>getBigDecimalList(int columnIndex)Returns the value of a non-NULLcolumn 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-NULLcolumn with typeType.array(Type.numeric())The list returned by this method is lazily constructed.protected abstract List<BigDecimal>getBigDecimalListInternal(int columnIndex)booleangetBoolean(int columnIndex)Returns the value of a non-NULLcolumn with typeType.bool().booleangetBoolean(String columnName)Returns the value of a non-NULLcolumn with typeType.bool().boolean[]getBooleanArray(int columnIndex)Returns the value of a non-NULLcolumn with typeType.array(Type.bool()).boolean[]getBooleanArray(String columnName)Returns the value of a non-NULLcolumn with typeType.array(Type.bool()).protected abstract boolean[]getBooleanArrayInternal(int columnIndex)protected abstract booleangetBooleanInternal(int columnIndex)List<Boolean>getBooleanList(int columnIndex)Returns the value of a non-NULLcolumn with typeType.array(Type.bool()).List<Boolean>getBooleanList(String columnName)Returns the value of a non-NULLcolumn with typeType.array(Type.bool()).protected abstract List<Boolean>getBooleanListInternal(int columnIndex)com.google.cloud.ByteArraygetBytes(int columnIndex)Returns the value of a non-NULLcolumn with typeType.bytes().com.google.cloud.ByteArraygetBytes(String columnName)Returns the value of a non-NULLcolumn with typeType.bytes().protected abstract com.google.cloud.ByteArraygetBytesInternal(int columnIndex)List<com.google.cloud.ByteArray>getBytesList(int columnIndex)Returns the value of a non-NULLcolumn with typeType.array(Type.bytes()).List<com.google.cloud.ByteArray>getBytesList(String columnName)Returns the value of a non-NULLcolumn with typeType.array(Type.bytes()).protected abstract List<com.google.cloud.ByteArray>getBytesListInternal(int columnIndex)intgetColumnCount()Returns the number of columns in the underlying data.intgetColumnIndex(String columnName)Returns the index of the column namedcolumnName.TypegetColumnType(int columnIndex)Returns the type of a column.TypegetColumnType(String columnName)Returns the type of a column.com.google.cloud.DategetDate(int columnIndex)Returns the value of a non-NULLcolumn with typeType.date().com.google.cloud.DategetDate(String columnName)Returns the value of a non-NULLcolumn with typeType.date().protected abstract com.google.cloud.DategetDateInternal(int columnIndex)List<com.google.cloud.Date>getDateList(int columnIndex)Returns the value of a non-NULLcolumn with typeType.array(Type.date()).List<com.google.cloud.Date>getDateList(String columnName)Returns the value of a non-NULLcolumn with typeType.array(Type.date()).protected abstract List<com.google.cloud.Date>getDateListInternal(int columnIndex)doublegetDouble(int columnIndex)Returns the value of a non-NULLcolumn with typeType.float64().doublegetDouble(String columnName)Returns the value of a non-NULLcolumn with typeType.float64().double[]getDoubleArray(int columnIndex)Returns the value of a non-NULLcolumn with typeType.array(Type.float64()).double[]getDoubleArray(String columnName)Returns the value of a non-NULLcolumn with typeType.array(Type.float64()).protected abstract double[]getDoubleArrayInternal(int columnIndex)protected abstract doublegetDoubleInternal(int columnIndex)List<Double>getDoubleList(int columnIndex)Returns the value of a non-NULLcolumn 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-NULLcolumn with typeType.array(Type.float64())The list returned by this method is lazily constructed.protected abstract List<Double>getDoubleListInternal(int columnIndex)StringgetJson(int columnIndex)Returns the value of a non-NULLcolumn with typeType.json().StringgetJson(String columnName)Returns the value of a non-NULLcolumn with typeType.json().protected StringgetJsonInternal(int columnIndex)List<String>getJsonList(int columnIndex)Returns the value of a non-NULLcolumn with typeType.array(Type.json()).List<String>getJsonList(String columnName)Returns the value of a non-NULLcolumn with typeType.array(Type.json()).protected List<String>getJsonListInternal(int columnIndex)longgetLong(int columnIndex)Returns the value of a non-NULLcolumn with typeType.int64().longgetLong(String columnName)Returns the value of a non-NULLcolumn with typeType.int64().long[]getLongArray(int columnIndex)Returns the value of a non-NULLcolumn with typeType.array(Type.int64()).long[]getLongArray(String columnName)Returns the value of a non-NULLcolumn with typeType.array(Type.int64()).protected abstract long[]getLongArrayInternal(int columnIndex)protected abstract longgetLongInternal(int columnIndex)List<Long>getLongList(int columnIndex)Returns the value of a non-NULLcolumn with typeType.array(Type.int64()).List<Long>getLongList(String columnName)Returns the value of a non-NULLcolumn with typeType.array(Type.int64()).protected abstract List<Long>getLongListInternal(int columnIndex)StringgetPgJsonb(int columnIndex)Returns the value of a non-NULLcolumn with typeType.pgJsonb().StringgetPgJsonb(String columnName)Returns the value of a non-NULLcolumn with typeType.pgJsonb().protected StringgetPgJsonbInternal(int columnIndex)List<String>getPgJsonbList(int columnIndex)Returns the value of a non-NULLcolumn 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-NULLcolumn with typeType.array(Type.pgJsonb())The list returned by this method is lazily constructed.protected List<String>getPgJsonbListInternal(int columnIndex)StringgetString(int columnIndex)Returns the value of a non-NULLcolumn with typeType.string().StringgetString(String columnName)Returns the value of a non-NULLcolumn with typeType.string().protected abstract StringgetStringInternal(int columnIndex)List<String>getStringList(int columnIndex)Returns the value of a non-NULLcolumn with typeType.array(Type.string()).List<String>getStringList(String columnName)Returns the value of a non-NULLcolumn with typeType.array(Type.string()).protected abstract List<String>getStringListInternal(int columnIndex)List<Struct>getStructList(int columnIndex)Returns the value of a non-NULLcolumn 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-NULLcolumn with typeType.array(Type.struct(...))The list returned by this method is lazily constructed.protected abstract List<Struct>getStructListInternal(int columnIndex)com.google.cloud.TimestampgetTimestamp(int columnIndex)Returns the value of a non-NULLcolumn with typeType.timestamp().com.google.cloud.TimestampgetTimestamp(String columnName)Returns the value of a non-NULLcolumn with typeType.timestamp().protected abstract com.google.cloud.TimestampgetTimestampInternal(int columnIndex)List<com.google.cloud.Timestamp>getTimestampList(int columnIndex)Returns the value of a non-NULLcolumn 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-NULLcolumn with typeType.array(Type.timestamp())The list returned by this method is lazily constructed.protected abstract List<com.google.cloud.Timestamp>getTimestampListInternal(int columnIndex)ValuegetValue(int columnIndex)Returns the value of a nullable column as aValue.ValuegetValue(String columnName)Returns the value of a nullable column as aValue.protected ValuegetValueInternal(int columnIndex)booleanisNull(String columnName)Returnstrueif a column contains aNULLvalue.-
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:StructReaderReturns the number of columns in the underlying data. This includes any columns withNULLvalues.- Specified by:
getColumnCountin interfaceStructReader
-
getColumnType
public Type getColumnType(int columnIndex)
Description copied from interface:StructReaderReturns the type of a column.- Specified by:
getColumnTypein interfaceStructReader
-
getColumnType
public Type getColumnType(String columnName)
Description copied from interface:StructReaderReturns the type of a column.- Specified by:
getColumnTypein interfaceStructReader
-
isNull
public boolean isNull(String columnName)
Description copied from interface:StructReaderReturnstrueif a column contains aNULLvalue.- Specified by:
isNullin interfaceStructReader
-
getBoolean
public boolean getBoolean(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.bool().- Specified by:
getBooleanin interfaceStructReader
-
getBoolean
public boolean getBoolean(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.bool().- Specified by:
getBooleanin interfaceStructReader
-
getLong
public long getLong(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.int64().- Specified by:
getLongin interfaceStructReader
-
getLong
public long getLong(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.int64().- Specified by:
getLongin interfaceStructReader
-
getDouble
public double getDouble(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.float64().- Specified by:
getDoublein interfaceStructReader
-
getDouble
public double getDouble(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.float64().- Specified by:
getDoublein interfaceStructReader
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.numeric().- Specified by:
getBigDecimalin interfaceStructReader
-
getBigDecimal
public BigDecimal getBigDecimal(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.numeric().- Specified by:
getBigDecimalin interfaceStructReader
-
getString
public String getString(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.string().- Specified by:
getStringin interfaceStructReader
-
getString
public String getString(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.string().- Specified by:
getStringin interfaceStructReader
-
getJson
public String getJson(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.json().- Specified by:
getJsonin interfaceStructReader
-
getJson
public String getJson(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.json().- Specified by:
getJsonin interfaceStructReader
-
getPgJsonb
public String getPgJsonb(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.pgJsonb().- Specified by:
getPgJsonbin interfaceStructReader
-
getPgJsonb
public String getPgJsonb(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.pgJsonb().- Specified by:
getPgJsonbin interfaceStructReader
-
getBytes
public com.google.cloud.ByteArray getBytes(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.bytes().- Specified by:
getBytesin interfaceStructReader
-
getBytes
public com.google.cloud.ByteArray getBytes(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.bytes().- Specified by:
getBytesin interfaceStructReader
-
getTimestamp
public com.google.cloud.Timestamp getTimestamp(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.timestamp().- Specified by:
getTimestampin interfaceStructReader
-
getTimestamp
public com.google.cloud.Timestamp getTimestamp(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.timestamp().- Specified by:
getTimestampin interfaceStructReader
-
getDate
public com.google.cloud.Date getDate(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.date().- Specified by:
getDatein interfaceStructReader
-
getDate
public com.google.cloud.Date getDate(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.date().- Specified by:
getDatein interfaceStructReader
-
getValue
public Value getValue(int columnIndex)
Description copied from interface:StructReaderReturns the value of a nullable column as aValue.- Specified by:
getValuein interfaceStructReader
-
getValue
public Value getValue(String columnName)
Description copied from interface:StructReaderReturns the value of a nullable column as aValue.- Specified by:
getValuein interfaceStructReader
-
getBooleanArray
public boolean[] getBooleanArray(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.array(Type.bool()).- Specified by:
getBooleanArrayin interfaceStructReader
-
getBooleanArray
public boolean[] getBooleanArray(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.array(Type.bool()).- Specified by:
getBooleanArrayin interfaceStructReader
-
getBooleanList
public List<Boolean> getBooleanList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getBooleanListin interfaceStructReader
-
getBooleanList
public List<Boolean> getBooleanList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getBooleanListin interfaceStructReader
-
getLongArray
public long[] getLongArray(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.array(Type.int64()).- Specified by:
getLongArrayin interfaceStructReader
-
getLongArray
public long[] getLongArray(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.array(Type.int64()).- Specified by:
getLongArrayin interfaceStructReader
-
getLongList
public List<Long> getLongList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getLongListin interfaceStructReader
-
getLongList
public List<Long> getLongList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getLongListin interfaceStructReader
-
getDoubleArray
public double[] getDoubleArray(int columnIndex)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.array(Type.float64()).- Specified by:
getDoubleArrayin interfaceStructReader
-
getDoubleArray
public double[] getDoubleArray(String columnName)
Description copied from interface:StructReaderReturns the value of a non-NULLcolumn with typeType.array(Type.float64()).- Specified by:
getDoubleArrayin interfaceStructReader
-
getDoubleList
public List<Double> getDoubleList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getDoubleListin interfaceStructReader
-
getDoubleList
public List<Double> getDoubleList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getDoubleListin interfaceStructReader
-
getBigDecimalList
public List<BigDecimal> getBigDecimalList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getBigDecimalListin interfaceStructReader
-
getBigDecimalList
public List<BigDecimal> getBigDecimalList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getBigDecimalListin interfaceStructReader
-
getStringList
public List<String> getStringList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getStringListin interfaceStructReader
-
getStringList
public List<String> getStringList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getStringListin interfaceStructReader
-
getJsonList
public List<String> getJsonList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getJsonListin interfaceStructReader
-
getJsonList
public List<String> getJsonList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getJsonListin interfaceStructReader
-
getPgJsonbList
public List<String> getPgJsonbList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getPgJsonbListin interfaceStructReader
-
getPgJsonbList
public List<String> getPgJsonbList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getPgJsonbListin interfaceStructReader
-
getBytesList
public List<com.google.cloud.ByteArray> getBytesList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getBytesListin interfaceStructReader
-
getBytesList
public List<com.google.cloud.ByteArray> getBytesList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getBytesListin interfaceStructReader
-
getTimestampList
public List<com.google.cloud.Timestamp> getTimestampList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getTimestampListin interfaceStructReader
-
getTimestampList
public List<com.google.cloud.Timestamp> getTimestampList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getTimestampListin interfaceStructReader
-
getDateList
public List<com.google.cloud.Date> getDateList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getDateListin interfaceStructReader
-
getDateList
public List<com.google.cloud.Date> getDateList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getDateListin interfaceStructReader
-
getStructList
public List<Struct> getStructList(int columnIndex)
Description copied from interface:StructReaderReturns 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.- Specified by:
getStructListin interfaceStructReader
-
getStructList
public List<Struct> getStructList(String columnName)
Description copied from interface:StructReaderReturns 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.- Specified by:
getStructListin interfaceStructReader
-
getColumnIndex
public int getColumnIndex(String columnName)
Description copied from interface:StructReaderReturns the index of the column namedcolumnName.- Specified by:
getColumnIndexin interfaceStructReader
-
checkNonNull
protected void checkNonNull(int columnIndex, Object columnNameForError)
-
-