Interface StructReader
@BetaApi
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.
-
Method Summary
Modifier and TypeMethodDescriptionbooleangetBoolean(int columnIndex) booleangetBoolean(String columnName) com.google.protobuf.ByteStringgetBytes(int columnIndex) com.google.protobuf.ByteStringcom.google.cloud.DategetDate(int columnIndex) com.google.cloud.DatedoublegetDouble(int columnIndex) Getter for FLOAT_64 type Sql datadoubleGetter for FLOAT_64 type Sql datafloatgetFloat(int columnIndex) Getter for FLOAT_32 type Sql datafloatGetter for FLOAT_32 type Sql data<ElemType> List<ElemType>getList(int columnIndex, SqlType.Array<ElemType> arrayType) <ElemType> List<ElemType>getList(String columnName, SqlType.Array<ElemType> arrayType) longgetLong(int columnIndex) long<K,V> Map<K, V> getMap(int columnIndex, SqlType.Map<K, V> mapType) <K,V> Map<K, V> getMap(String columnName, SqlType.Map<K, V> mapType) getString(int columnIndex) getStruct(int columnIndex) org.threeten.bp.InstantgetTimestamp(int columnIndex) org.threeten.bp.InstantgetTimestamp(String columnName) booleanisNull(int columnIndex) boolean
-
Method Details
-
isNull
boolean isNull(int columnIndex) - Parameters:
columnIndex- index of the column- Returns:
trueif the column contains aNULLvalue
-
isNull
- Parameters:
columnName- name of the column- Returns:
trueif the column contains aNULLvalue- Throws:
IllegalArgumentException- if there is not exactly one column with the given name
-
getBytes
com.google.protobuf.ByteString getBytes(int columnIndex) - Parameters:
columnIndex- index of the column- Returns:
ByteStringtype value of a non-NULLcolumn
-
getBytes
- Parameters:
columnName- name of the column- Returns:
ByteStringtype value of a non-NULLcolumn
-
getString
- Parameters:
columnIndex- index of the column- Returns:
Stringtype value of a non-NULLcolumn
-
getString
- Parameters:
columnName- name of the column- Returns:
Stringtype value of a non-NULLcolumn
-
getLong
long getLong(int columnIndex) - Parameters:
columnIndex- index of the column- Returns:
longtype value of a non-NULLcolumn
-
getLong
- Parameters:
columnName- name of the column- Returns:
longtype value of a non-NULLcolumn
-
getDouble
double getDouble(int columnIndex) Getter for FLOAT_64 type Sql data- Parameters:
columnIndex- index of the column- Returns:
doubletype value of a non-NULLcolumn
-
getDouble
Getter for FLOAT_64 type Sql data- Parameters:
columnName- name of the column- Returns:
doubletype value of a non-NULLcolumn
-
getFloat
float getFloat(int columnIndex) Getter for FLOAT_32 type Sql data- Parameters:
columnIndex- index of the column- Returns:
floattype value of a non-NULLcolumn
-
getFloat
Getter for FLOAT_32 type Sql data- Parameters:
columnName- name of the column- Returns:
floattype value of a non-NULLcolumn
-
getBoolean
boolean getBoolean(int columnIndex) - Parameters:
columnIndex- index of the column- Returns:
booleantype value of a non-NULLcolumn
-
getBoolean
- Parameters:
columnName- name of the column- Returns:
booleantype value of a non-NULLcolumn
-
getTimestamp
org.threeten.bp.Instant getTimestamp(int columnIndex) - Parameters:
columnIndex- index of the column- Returns:
Instanttype value of a non-NULLcolumn
-
getTimestamp
- Parameters:
columnName- name of the column- Returns:
Instanttype value of a non-NULLcolumn
-
getDate
com.google.cloud.Date getDate(int columnIndex) - Parameters:
columnIndex- index of the column- Returns:
Datetype value of a non-NULLcolumn
-
getDate
- Parameters:
columnName- name of the column- Returns:
Datetype value of a non-NULLcolumn
-
getStruct
- Parameters:
columnIndex- index of the column- Returns:
Structtype value of a non-NULLcolumn
-
getStruct
- Parameters:
columnName- name of the column- Returns:
Structtype value of a non-NULLcolumn
-
getList
- Type Parameters:
ElemType- Java type of the list elements- Parameters:
columnIndex- index of the column- Returns:
Listtype value of a non-NULLcolumn
-
getList
- Type Parameters:
ElemType- Java type of the list elements- Parameters:
columnName- name of the column- Returns:
Listtype value of a non-NULLcolumn
-
getMap
- Type Parameters:
K- Java type of the map keysV- Java type of the map values- Parameters:
columnIndex- index of the column- Returns:
Maptype value of a non-NULLcolumn
-
getMap
- Type Parameters:
K- Java type of the map keysV- Java type of the map values- Parameters:
columnName- name of the column- Returns:
Maptype value of a non-NULLcolumn
-