Send feedback
Class OptionsMetadata (0.27.1)
Stay organized with collections
Save and categorize content based on your preferences.
Version latestkeyboard_arrow_down
public class OptionsMetadata
Metadata extractor for CLI.
Static Fields
public static final String DEFAULT_SERVER_VERSION
Field Value
Type
Description
String
Static Methods
public static boolean isJava8 ()
Returns true if the current JVM is Java 8.
public static OptionsMetadata . Builder newBuilder ()
public static String toServerVersionNum ( String version )
Parameter
Name
Description
version
String
Returns
Type
Description
String
Constructors
OptionsMetadata(String defaultConnectionUrl, int proxyPort, OptionsMetadata.TextFormat textFormat, boolean forceBinary, boolean authenticate, boolean requiresMatcher, boolean replaceJdbcMetadataQueries, JSONObject commandMetadata) (deprecated)
public OptionsMetadata ( String defaultConnectionUrl , int proxyPort , OptionsMetadata . TextFormat textFormat , boolean forceBinary , boolean authenticate , boolean requiresMatcher , boolean replaceJdbcMetadataQueries , JSONObject commandMetadata )
Deprecated. Use #newBuilder() to create an options builder, and then call Builder#build() instead of using this constructor.
public OptionsMetadata ( String [] args )
Creates a new instance of OptionsMetadata from the given arguments.
It is recommended to use #newBuilder() to create an options Builder instead
of calling this method directly.
Parameter
Name
Description
args
String []
Methods
public String buildConnectionURL ( String database )
Takes user inputs and builds a JDBC connection string from them.
Parameter
Name
Description
database
String
Returns
Type
Description
String
The parsed JDBC connection string.
public String buildCredentialsFile ()
Get credential file path from either command line or application default. If neither are set,
then throw an error.
Returns
Type
Description
String
The absolute path of the credentials file.
public boolean disableLocalhostCheck ()
public JSONObject getCommandMetadataJSON ()
Returns
Type
Description
org.json.simple.JSONObject
public String getConnectionURL ()
Returns
Type
Description
String
the default connection URL that is used by the server.
public Credentials getCredentials ()
Returns the Credentials instance that has been set for this OptionsMetadata .
This overrides both any credentials file and any default credentials in the current runtime
environment.
Returns
Type
Description
com.google.auth.Credentials
public DatabaseName getDatabaseName ( String database )
Returns the fully qualified database name based on the given database id or name.
Parameter
Name
Description
database
String
Returns
Type
Description
com.google.spanner.v1.DatabaseName
public OptionsMetadata . DdlTransactionMode getDdlTransactionMode ()
public String getDefaultConnectionUrl ()
Returns the default connection URL that is used by the server. If a default connection URL has
been set, the database parameter in a connection request will be ignored, and the database in
this connection URL will be used instead.
Returns
Type
Description
String
the default connection URL that is used by the server.
public DatabaseId getDefaultDatabaseId ()
Returns the id of the default database or null if no default has been selected.
Returns
Type
Description
com.google.cloud.spanner.DatabaseId
public InstanceId getDefaultInstanceId ()
Returns the id of the default instance or null if no default has been selected.
Returns
Type
Description
com.google.cloud.spanner.InstanceId
public int getMaxBacklog ()
Returns
Type
Description
int
public Double getOpenTelemetryTraceRatio ()
Returns
Type
Description
Double
public Map<String , String > getPropertyMap ()
public int getProxyPort ()
Returns
Type
Description
int
public String getServerVersion ()
Returns
Type
Description
String
public String getServerVersionNum ()
Returns
Type
Description
String
public SessionPoolOptions getSessionPoolOptions ()
Returns
Type
Description
com.google.cloud.spanner.SessionPoolOptions
public String getSocketFile ( int localPort )
Parameter
Name
Description
localPort
int
Returns
Type
Description
String
public OptionsMetadata . SslMode getSslMode ()
public Credentials getTelemetryCredentials ()
Returns
Type
Description
com.google.auth.Credentials
public String getTelemetryProjectId ()
Returns
Type
Description
String
getTextFormat()
public OptionsMetadata . TextFormat getTextFormat ()
public boolean hasDefaultConnectionUrl ()
Returns
Type
Description
boolean
true if the server uses a default connection URL and ignores the database in a
connection request
public boolean hasDefaultInstanceId ()
Returns true if these options contain a default instance id.
public boolean isBinaryFormat ()
public boolean isDebugMode ()
isDomainSocketEnabled()
public boolean isDomainSocketEnabled ()
public boolean isEnableOpenTelemetry ()
public boolean isReplaceJdbcMetadataQueries ()
public boolean isWindows ()
Returns true if the OS is Windows.
public boolean replacePgCatalogTables ()
public boolean requiresMatcher ()
public boolean shouldAuthenticate ()
public boolean shouldAutoDetectClient ()
public boolean useDefaultLocalStatements ()
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-17 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-17 UTC."],[],[]]