# Interface SessionOrBuilder (6.118.0)

6.118.0 (latest) 6.116.0 6.111.1 6.108.0 6.107.0 6.103.0 6.102.1 6.101.1 6.100.0 6.99.0 6.98.1 6.97.1 6.96.1 6.95.1 6.94.0 6.93.0 6.89.0 6.88.0 6.87.0 6.86.0 6.85.0 6.83.0 6.82.0 6.80.1 6.79.0 6.77.0 6.74.1 6.72.0 6.71.0 6.69.0 6.68.0 6.66.0 6.65.1 6.62.0 6.60.0 6.58.0 6.57.0 6.56.0 6.55.0 6.54.0 6.53.0 6.52.1 6.51.0 6.50.1 6.49.0 6.25.1 6.24.0 6.23.4 6.22.0 6.21.2 6.20.0 6.19.1 6.18.0 6.17.4 6.14.1

    public interface SessionOrBuilder extends MessageOrBuilder

## Implements

[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)

## Methods

### containsLabels(String key)

    public abstract boolean containsLabels(String key)

The labels for the session.

- Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?`.
- Label values must be between 0 and 63 characters long and must conform to the regular expression `(https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?)?`.
- No more than 64 labels can be associated with a given session.

  See <https://goo.gl/xmQnxf> for more information on and examples of labels.

`map<string, string> labels = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `key` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getApproximateLastUseTime()

    public abstract Timestamp getApproximateLastUseTime()

Output only. The approximate timestamp when the session is last used. It's
typically earlier than the actual last use time.

`
.google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Timestamp.html` | The approximateLastUseTime. |

### getApproximateLastUseTimeOrBuilder()

    public abstract TimestampOrBuilder getApproximateLastUseTimeOrBuilder()

Output only. The approximate timestamp when the session is last used. It's
typically earlier than the actual last use time.

`
.google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.TimestampOrBuilder.html` |   |

### getCreateTime()

    public abstract Timestamp getCreateTime()

Output only. The timestamp when the session is created.

`.google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Timestamp.html` | The createTime. |

### getCreateTimeOrBuilder()

    public abstract TimestampOrBuilder getCreateTimeOrBuilder()

Output only. The timestamp when the session is created.

`.google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.TimestampOrBuilder.html` |   |

### getCreatorRole()

    public abstract String getCreatorRole()

The database role which created this session.

`string creator_role = 5;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The creatorRole. |

### getCreatorRoleBytes()

    public abstract ByteString getCreatorRoleBytes()

The database role which created this session.

`string creator_role = 5;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for creatorRole. |

### getLabels() (deprecated)

    public abstract Map<String,String> getLabels()

Use [#getLabelsMap()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.v1.SessionOrBuilder#com_google_spanner_v1_SessionOrBuilder_getLabelsMap__) instead.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### getLabelsCount()

    public abstract int getLabelsCount()

The labels for the session.

- Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?`.
- Label values must be between 0 and 63 characters long and must conform to the regular expression `(https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?)?`.
- No more than 64 labels can be associated with a given session.

  See <https://goo.gl/xmQnxf> for more information on and examples of labels.

`map<string, string> labels = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getLabelsMap()

    public abstract Map<String,String> getLabelsMap()

The labels for the session.

- Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?`.
- Label values must be between 0 and 63 characters long and must conform to the regular expression `(https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?)?`.
- No more than 64 labels can be associated with a given session.

  See <https://goo.gl/xmQnxf> for more information on and examples of labels.

`map<string, string> labels = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### getLabelsOrDefault(String key, String defaultValue)

    public abstract String getLabelsOrDefault(String key, String defaultValue)

The labels for the session.

- Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?`.
- Label values must be between 0 and 63 characters long and must conform to the regular expression `(https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?)?`.
- No more than 64 labels can be associated with a given session.

  See <https://goo.gl/xmQnxf> for more information on and examples of labels.

`map<string, string> labels = 2;`

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `key` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `defaultValue` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getLabelsOrThrow(String key)

    public abstract String getLabelsOrThrow(String key)

The labels for the session.

- Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?`.
- Label values must be between 0 and 63 characters long and must conform to the regular expression `(https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/[-a-z0-9]*[a-z0-9]?)?`.
- No more than 64 labels can be associated with a given session.

  See <https://goo.gl/xmQnxf> for more information on and examples of labels.

`map<string, string> labels = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `key` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getMultiplexed()

    public abstract boolean getMultiplexed()

Optional. If `true`, specifies a multiplexed session. Use a multiplexed
session for multiple, concurrent operations including any combination of
read-only and read-write transactions. Use
`sessions.create` to create
multiplexed sessions. Don't use
BatchCreateSessions to
create a multiplexed session. You can't delete or list multiplexed
sessions.

`bool multiplexed = 6 [(.google.api.field_behavior) = OPTIONAL];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The multiplexed. |

### getName()

    public abstract String getName()

Output only. The name of the session. This is always system-assigned.

`string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The name. |

### getNameBytes()

    public abstract ByteString getNameBytes()

Output only. The name of the session. This is always system-assigned.

`string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for name. |

### hasApproximateLastUseTime()

    public abstract boolean hasApproximateLastUseTime()

Output only. The approximate timestamp when the session is last used. It's
typically earlier than the actual last use time.

`
.google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the approximateLastUseTime field is set. |

### hasCreateTime()

    public abstract boolean hasCreateTime()

Output only. The timestamp when the session is created.

`.google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the createTime field is set. |