Skip to content

Commit 0746702

Browse files
committed
chore: make valid connection properties public
Make the list of valid connection properties public, so tools that depend on the Connection API can use this to for example generate documentation for valid properties.
1 parent 8547735 commit 0746702

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
import com.google.common.collect.ImmutableMap;
116116
import com.google.spanner.v1.DirectedReadOptions;
117117
import java.time.Duration;
118-
import java.util.Map;
119118

120119
/**
121120
* Utility class that defines all known connection properties. This class will eventually replace
@@ -541,7 +540,7 @@ class ConnectionProperties {
541540
BooleanConverter.INSTANCE,
542541
Context.USER);
543542

544-
static final Map<String, ConnectionProperty<?>> CONNECTION_PROPERTIES =
543+
static final ImmutableMap<String, ConnectionProperty<?>> CONNECTION_PROPERTIES =
545544
CONNECTION_PROPERTIES_BUILDER.build();
546545

547546
/** Utility method for creating a new core {@link ConnectionProperty}. */

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.cloud.spanner.ErrorCode;
2020
import com.google.cloud.spanner.SpannerExceptionFactory;
2121
import com.google.common.base.Strings;
22+
import com.google.common.collect.ImmutableList;
2223
import java.util.Locale;
2324
import javax.annotation.Nonnull;
2425
import javax.annotation.Nullable;
@@ -37,6 +38,9 @@
3738
* connection state is an opt-in.
3839
*/
3940
public class ConnectionProperty<T> {
41+
public static ImmutableList<ConnectionProperty<?>> VALID_CONNECTION_PROPERTIES =
42+
ImmutableList.copyOf(ConnectionProperties.CONNECTION_PROPERTIES.values());
43+
4044
/**
4145
* Context indicates when a {@link ConnectionProperty} may be set. Each higher-ordinal value
4246
* includes the preceding values, meaning that a {@link ConnectionProperty} with {@link

0 commit comments

Comments
 (0)