# Interface StructReader (2.79.0)

2.79.0 (latest) 2.78.1 2.77.0 2.74.0 2.73.0 2.72.0 2.71.0 2.70.0 2.68.0 2.67.1 2.66.0 2.65.1 2.63.0 2.62.0 2.61.0 2.60.0 2.59.0 2.58.2 2.56.0 2.54.0 2.52.0 2.51.2 2.49.0 2.46.0 2.45.1 2.44.1 2.43.0 2.42.0 2.40.0 2.39.5 2.37.0 2.35.1 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.1 2.28.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)](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.sql.StructReader#com_google_cloud_bigtable_data_v2_models_sql_StructReader_isNull_int_) \& [#isNull(String)](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.sql.StructReader#com_google_cloud_bigtable_data_v2_models_sql_StructReader_isNull_java_lang_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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |
| `arrayType` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.sql.SqlType.Array<ElemType>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<ElemType>` | [List](https://docs.oracle.com/javase/8/docs/api/java/util/List.html) 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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |
| `arrayType` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.sql.SqlType.Array<ElemType>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<ElemType>` | [List](https://docs.oracle.com/javase/8/docs/api/java/util/List.html) 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)

> [!WARNING]
> **Beta**
>
> *This feature is currently experimental and can change in the future*
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Returns the value of a non-`NULL` column with a protobuf enum type.
See Also: [forNumber()](https://developers.google.com/protocol-buffers/docs/reference/java-generated#enum)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `columnIndex` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column. |
| `forNumber` | `https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html<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)

> [!WARNING]
> **Beta**
>
> *This feature is currently experimental and can change in the future*
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Returns the value of a non-`NULL` column with a protobuf enum type.
See Also: [forNumber()](https://developers.google.com/protocol-buffers/docs/reference/java-generated#enum)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `columnName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column. |
| `forNumber` | `https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html<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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |
| `mapType` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.sql.SqlType.Map<K,V>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<K,V>` | [Map](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html) 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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |
| `mapType` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.sql.SqlType.Map<K,V>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<K,V>` | [Map](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html) type value of a non-`NULL` column |

### \<MsgType\>getProtoMessage(int columnIndex, MsgType message)

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

> [!WARNING]
> **Beta**
>
> *This feature is currently experimental and can change in the future*
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Returns the value of a non-`NULL` column with a protobuf message type.
See Also: [getDefaultInstance()](https://developers.google.com/protocol-buffers/docs/reference/java-generated#message)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `columnIndex` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` 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)

> [!WARNING]
> **Beta**
>
> *This feature is currently experimental and can change in the future*
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Returns the value of a non-`NULL` column with a protobuf message type.
See Also: [getDefaultInstance()](https://developers.google.com/protocol-buffers/docs/reference/java-generated#message)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `columnName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` 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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | [boolean](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) type value of a non-`NULL` column |

### getBoolean(String columnName)

    public abstract boolean getBoolean(String columnName)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | [boolean](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) type value of a non-`NULL` column |

### getBytes(int columnIndex)

    public abstract ByteString getBytes(int columnIndex)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnIndex` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | [ByteString](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html) type value of a non-`NULL` column |

### getBytes(String columnName)

    public abstract ByteString getBytes(String columnName)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | [ByteString](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html) type value of a non-`NULL` column |

### getDate(int columnIndex)

    public abstract Date getDate(int columnIndex)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnIndex` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` 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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` 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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | [double](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) 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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | [double](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) 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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | [float](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) 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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | [float](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) type value of a non-`NULL` column |

### getLong(int columnIndex)

    public abstract long getLong(int columnIndex)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnIndex` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | [long](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) type value of a non-`NULL` column |

### getLong(String columnName)

    public abstract long getLong(String columnName)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | [long](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) type value of a non-`NULL` column |

### getString(int columnIndex)

    public abstract String getString(int columnIndex)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnIndex` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | [String](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html) type value of a non-`NULL` column |

### getString(String columnName)

    public abstract String getString(String columnName)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | [String](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html) type value of a non-`NULL` column |

### getStruct(int columnIndex)

    public abstract Struct getStruct(int columnIndex)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnIndex` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.sql.Struct` | [com.google.cloud.bigtable.data.v2.models.sql.Struct](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.sql.Struct` | [com.google.cloud.bigtable.data.v2.models.sql.Struct](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html` | [Instant](https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html) type value of a non-`NULL` column |

### getTimestamp(String columnName)

    public abstract Instant getTimestamp(String columnName)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html` | [Instant](https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html) type value of a non-`NULL` column |

### isNull(int columnIndex)

    public abstract boolean isNull(int columnIndex)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnIndex` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` index of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | `true` if the column contains a `NULL` value |

### isNull(String columnName)

    public abstract boolean isNull(String columnName)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `columnName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` name of the column |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | `true` if the column contains a `NULL` value |