Interface StructReader (2.67.0)

public interface StructReader

An interface for reading the columns of a Struct or com.google.cloud.bigtable.data.v2.models.sql.ResultSet.

This provides accessors for each valid type in the form of getTypeName(). Attempting to call these methods for a column of another type will result in an IllegalStateException. Each method has an overload accepting both int column index and String column Name. Attempting to call an index-based method with a non-existent index will result in an IndexOutOfBoundsException. Attempting to call a columnName based getter with a column name that does not appear exactly once in the set of fields will result in an IllegalArgumentException. Attempting to access a column with a null value will result in a NullPointerException; #isNull(int) & #isNull(String) can be used to check for null values.

Methods

<ElemType>getList(int columnIndex, SqlType.Array<ElemType> arrayType)

public abstract List<ElemType> <ElemType>getList(int columnIndex, SqlType.Array<ElemType> arrayType)
Parameters
Name Description
columnIndex int

index of the column

arrayType Array<ElemType>
Returns
Type Description
List<ElemType>

List type value of a non-NULL column

<ElemType>getList(String columnName, SqlType.Array<ElemType> arrayType)

public abstract List<ElemType> <ElemType>getList(String columnName, SqlType.Array<ElemType> arrayType)
Parameters
Name Description
columnName String

name of the column

arrayType Array<ElemType>
Returns
Type Description
List<ElemType>

List type value of a non-NULL column

<EnumType>getProtoEnum(int columnIndex, Function<Integer,EnumType> forNumber)

public abstract EnumType <EnumType>getProtoEnum(int columnIndex, Function<Integer,EnumType> forNumber)

Returns the value of a non-NULL column with a protobuf enum type. See Also: forNumber()

Parameters
Name Description
columnIndex int

index of the column.

forNumber Function<java.lang.Integer,EnumType>

a function to convert an integer to the enum value. This is usually MyEnum::forNumber.

Returns
Type Description
EnumType

<EnumType>getProtoEnum(String columnName, Function<Integer,EnumType> forNumber)

public abstract EnumType <EnumType>getProtoEnum(String columnName, Function<Integer,EnumType> forNumber)

Returns the value of a non-NULL column with a protobuf enum type. See Also: forNumber()

Parameters
Name Description
columnName String

name of the column.

forNumber Function<java.lang.Integer,EnumType>

a function to convert an integer to the enum value. This is usually MyEnum::forNumber.

Returns
Type Description
EnumType

<K,V>getMap(int columnIndex, SqlType.Map<K,V> mapType)

public abstract Map<K,V> <K,V>getMap(int columnIndex, SqlType.Map<K,V> mapType)
Parameters
Name Description
columnIndex int

index of the column

mapType Map<K,V>
Returns
Type Description
Map<K,V>

Map type value of a non-NULL column

<K,V>getMap(String columnName, SqlType.Map<K,V> mapType)

public abstract Map<K,V> <K,V>getMap(String columnName, SqlType.Map<K,V> mapType)
Parameters
Name Description
columnName String

name of the column

mapType Map<K,V>
Returns
Type Description
Map<K,V>

Map type value of a non-NULL column

<MsgType>getProtoMessage(int columnIndex, MsgType message)

public abstract MsgType <MsgType>getProtoMessage(int columnIndex, MsgType message)

Returns the value of a non-NULL column with a protobuf message type. See Also: getDefaultInstance()

Parameters
Name Description
columnIndex int

index of the column.

message MsgType

an instance of the message. This is used to determine the message type and parser. MyMessage.getDefaultInstance() can be used.

Returns
Type Description
MsgType

<MsgType>getProtoMessage(String columnName, MsgType message)

public abstract MsgType <MsgType>getProtoMessage(String columnName, MsgType message)

Returns the value of a non-NULL column with a protobuf message type. See Also: getDefaultInstance()

Parameters
Name Description
columnName String

name of the column.

message MsgType

an instance of the message. This is used to determine the message type and parser. MyMessage.getDefaultInstance() can be used.

Returns
Type Description
MsgType

getBoolean(int columnIndex)

public abstract boolean getBoolean(int columnIndex)
Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
boolean

boolean type value of a non-NULL column

getBoolean(String columnName)

public abstract boolean getBoolean(String columnName)
Parameter
Name Description
columnName String

name of the column

Returns
Type Description
boolean

boolean type value of a non-NULL column

getBytes(int columnIndex)

public abstract ByteString getBytes(int columnIndex)
Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
ByteString

ByteString type value of a non-NULL column

getBytes(String columnName)

public abstract ByteString getBytes(String columnName)
Parameter
Name Description
columnName String

name of the column

Returns
Type Description
ByteString

ByteString type value of a non-NULL column

getDate(int columnIndex)

public abstract Date getDate(int columnIndex)
Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
com.google.cloud.Date

Date type value of a non-NULL column

getDate(String columnName)

public abstract Date getDate(String columnName)
Parameter
Name Description
columnName String

name of the column

Returns
Type Description
com.google.cloud.Date

Date type value of a non-NULL column

getDouble(int columnIndex)

public abstract double getDouble(int columnIndex)

Getter for FLOAT_64 type Sql data

Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
double

double type value of a non-NULL column

getDouble(String columnName)

public abstract double getDouble(String columnName)

Getter for FLOAT_64 type Sql data

Parameter
Name Description
columnName String

name of the column

Returns
Type Description
double

double type value of a non-NULL column

getFloat(int columnIndex)

public abstract float getFloat(int columnIndex)

Getter for FLOAT_32 type Sql data

Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
float

float type value of a non-NULL column

getFloat(String columnName)

public abstract float getFloat(String columnName)

Getter for FLOAT_32 type Sql data

Parameter
Name Description
columnName String

name of the column

Returns
Type Description
float

float type value of a non-NULL column

getLong(int columnIndex)

public abstract long getLong(int columnIndex)
Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
long

long type value of a non-NULL column

getLong(String columnName)

public abstract long getLong(String columnName)
Parameter
Name Description
columnName String

name of the column

Returns
Type Description
long

long type value of a non-NULL column

getString(int columnIndex)

public abstract String getString(int columnIndex)
Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
String

String type value of a non-NULL column

getString(String columnName)

public abstract String getString(String columnName)
Parameter
Name Description
columnName String

name of the column

Returns
Type Description
String

String type value of a non-NULL column

getStruct(int columnIndex)

public abstract Struct getStruct(int columnIndex)
Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
Struct

com.google.cloud.bigtable.data.v2.models.sql.Struct type value of a non- NULL column

getStruct(String columnName)

public abstract Struct getStruct(String columnName)
Parameter
Name Description
columnName String

name of the column

Returns
Type Description
Struct

com.google.cloud.bigtable.data.v2.models.sql.Struct type value of a non- NULL column

getTimestamp(int columnIndex)

public abstract Instant getTimestamp(int columnIndex)
Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
Instant

Instant type value of a non-NULL column

getTimestamp(String columnName)

public abstract Instant getTimestamp(String columnName)
Parameter
Name Description
columnName String

name of the column

Returns
Type Description
Instant

Instant type value of a non-NULL column

isNull(int columnIndex)

public abstract boolean isNull(int columnIndex)
Parameter
Name Description
columnIndex int

index of the column

Returns
Type Description
boolean

true if the column contains a NULL value

isNull(String columnName)

public abstract boolean isNull(String columnName)
Parameter
Name Description
columnName String

name of the column

Returns
Type Description
boolean

true if the column contains a NULL value