Skip to content

Commit 0f8b5dc

Browse files
chore: make getSpanner a public method (#3022)
* chore: make getSpanner a public method The underlying Spanner instance is often needed by the libraries that use the Connection API, and should therefore be made public. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: add clirr diff --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 021d7d8 commit 0f8b5dc

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

java-spanner/google-cloud-spanner/clirr-ignored-differences.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,4 +649,12 @@
649649
<className>com/google/cloud/spanner/connection/Connection</className>
650650
<method>void setMaxCommitDelay(java.time.Duration)</method>
651651
</difference>
652+
653+
<!-- Make getSpanner() public -->
654+
<difference>
655+
<differenceType>7012</differenceType>
656+
<className>com/google/cloud/spanner/connection/Connection</className>
657+
<method>com.google.cloud.spanner.Spanner getSpanner()</method>
658+
</difference>
659+
652660
</differences>

java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/Connection.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.google.cloud.spanner.PartitionOptions;
3434
import com.google.cloud.spanner.ReadContext.QueryAnalyzeMode;
3535
import com.google.cloud.spanner.ResultSet;
36+
import com.google.cloud.spanner.Spanner;
3637
import com.google.cloud.spanner.SpannerBatchUpdateException;
3738
import com.google.cloud.spanner.SpannerException;
3839
import com.google.cloud.spanner.Statement;
@@ -1370,6 +1371,12 @@ default DatabaseClient getDatabaseClient() {
13701371
throw new UnsupportedOperationException("Not implemented");
13711372
}
13721373

1374+
/** The {@link Spanner} instance that is used by this {@link Connection}. */
1375+
@InternalApi
1376+
default Spanner getSpanner() {
1377+
throw new UnsupportedOperationException("Not implemented");
1378+
}
1379+
13731380
/**
13741381
* This query option is used internally to indicate that a query is executed by the library itself
13751382
* to fetch metadata. These queries are specifically allowed to be executed even when a DDL batch

java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ static UnitOfWorkType of(TransactionMode transactionMode) {
305305
setDefaultTransactionOptions();
306306
}
307307

308-
@VisibleForTesting
309-
Spanner getSpanner() {
308+
@Override
309+
public Spanner getSpanner() {
310310
return this.spanner;
311311
}
312312

0 commit comments

Comments
 (0)