Class Struct
- java.lang.Object
-
- com.google.cloud.spanner.AbstractStructReader
-
- com.google.cloud.spanner.Struct
-
- All Implemented Interfaces:
StructReader,Serializable
@Immutable public abstract class Struct extends AbstractStructReader implements Serializable
Represents a non-NULLvalue ofType.Code.STRUCT. Such values are a tuple of named and typed columns, where individual columns may be null. Individual rows from a read or query operation can be considered as structs;ResultSet.getCurrentRowAsStruct()allows an immutable struct to be created from the row that the result set is currently positioned over.Structinstances are immutable.This class does not support representing typed
NULLStructvalues.However, struct values inside SQL queries are always typed and can be externally supplied to a query only in the form of struct/array-of-struct query parameter values for which typed
NULLstruct values can be specified in the following ways:1. As a standalone
NULLstruct value or as a nested struct field value, constructed usingValueBinder.to(Type, Struct)orValue.struct(Type, Struct).2. As as a null
Structreference representing aNULLstruct typed element value inside an array/list of 'Struct' references, that is used to construct an array-of-struct value usingValue.structArray(Type, Iterable)orValueBinder.toStructArray(Type, Iterable). In this case, the type of theNULLstruct value is assumed to be the same as the explicitly specified struct element type of the array/list.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStruct.BuilderBuilder for constructing non-NULLStructinstances.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StructgetStruct(int columnIndex)TODO(user) : Consider moving these methods to the StructReader interface once STRUCT-typed columns are supported inResultSet.StructgetStruct(String columnName)protected abstract StructgetStructInternal(int columnIndex)inthashCode()static Struct.BuildernewBuilder()Returns a builder for creating a non-NULLStructinstance.-
Methods inherited from class com.google.cloud.spanner.AbstractStructReader
checkNonNull, getBigDecimal, getBigDecimal, getBigDecimalInternal, getBigDecimalList, getBigDecimalList, getBigDecimalListInternal, getBoolean, getBoolean, getBooleanArray, getBooleanArray, getBooleanArrayInternal, getBooleanInternal, getBooleanList, getBooleanList, getBooleanListInternal, getBytes, getBytes, getBytesInternal, getBytesList, getBytesList, getBytesListInternal, getColumnCount, getColumnIndex, getColumnType, getColumnType, getDate, getDate, getDateInternal, getDateList, getDateList, getDateListInternal, getDouble, getDouble, getDoubleArray, getDoubleArray, getDoubleArrayInternal, getDoubleInternal, getDoubleList, getDoubleList, getDoubleListInternal, getJson, getJson, getJsonInternal, getJsonList, getJsonList, getJsonListInternal, getLong, getLong, getLongArray, getLongArray, getLongArrayInternal, getLongInternal, getLongList, getLongList, getLongListInternal, getPgJsonb, getPgJsonb, getPgJsonbInternal, getPgJsonbList, getPgJsonbList, getPgJsonbListInternal, getString, getString, getStringInternal, getStringList, getStringList, getStringListInternal, getStructList, getStructList, getStructListInternal, getTimestamp, getTimestamp, getTimestampInternal, getTimestampList, getTimestampList, getTimestampListInternal, getValue, getValue, getValueInternal, isNull
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.cloud.spanner.StructReader
getType, isNull
-
-
-
-
Method Detail
-
newBuilder
public static Struct.Builder newBuilder()
Returns a builder for creating a non-NULLStructinstance.
-
getStruct
public Struct getStruct(int columnIndex)
TODO(user) : Consider moving these methods to the StructReader interface once STRUCT-typed columns are supported inResultSet.
-
getStructInternal
protected abstract Struct getStructInternal(int columnIndex)
-
-