public abstract class CommandThis 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.
Static Methods
getCommands(String sql, Connection connection, JSONObject commandMetadataJSON)
public static List<Command> getCommands(String sql, Connection connection, JSONObject commandMetadataJSON)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 | 
        StringThe SQL command to be translated.  | 
      
connection | 
        ConnectionThe connection currently in use.  | 
      
commandMetadataJSON | 
        org.json.simple.JSONObject | 
      
| Returns | |
|---|---|
| Type | Description | 
List<Command> | 
        A list of all Command subclasses.  | 
      
Fields
matcher
protected Matcher matcher| Field Value | |
|---|---|
| Type | Description | 
Matcher | 
        |
sql
protected String sql| Field Value | |
|---|---|
| Type | Description | 
String | 
        |
Methods
getPattern()
protected abstract Pattern getPattern()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()
public boolean is()| Returns | |
|---|---|
| Type | Description | 
boolean | 
        True if the SQL statement matches the pattern.  | 
      
translate()
public abstract String translate()| Returns | |
|---|---|
| Type | Description | 
String | 
        The equivalent Spanner statement for the specified SQL statement.  |