Class Command (0.6.1)

publicabstractclass Command

This abstract class concerns itself with representing a method of matching a specific statement and translating it to a form that Spanner understands. The user should call is() to determine whether it matches before trying to translate.

Inheritance

java.lang.Object > Command

Static Methods

getCommands(String sql, Connection connection, JSONObject commandMetadataJSON)

publicstaticList<Command>getCommands(Stringsql,Connectionconnection,JSONObjectcommandMetadataJSON)

The list of all subcommands to this command. When subclassing this, make sure to add the new command to the below list, if applicable (i.e.: if you want it to be run). Commands may also be specified via Dynamic Commands, which are defined from an input JSON file. These commands precede the hard-coded ones in execution.

Parameters
Name Description
sql String

The SQL command to be translated.

connection Connection

The connection currently in use.

commandMetadataJSON org.json.simple.JSONObject
Returns
Type Description
List<Command>

A list of all Command subclasses.

Fields

matcher

protectedMatchermatcher
Field Value
Type Description

sql

protectedStringsql
Field Value
Type Description

Methods

getPattern()

protectedabstractPatterngetPattern()

The pattern expected by this command: is() will only return true if it matches this pattern.

Returns
Type Description
Pattern

The pattern apposite (in relation to) the command.

is()

publicbooleanis()
Returns
Type Description
boolean

True if the SQL statement matches the pattern.

translate()

publicabstractStringtranslate()
Returns
Type Description
String

The equivalent Spanner statement for the specified SQL statement.

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年10月30日 UTC.