Class DatabaseId

java.lang.Object
com.google.cloud.spanner.DatabaseId

public final class DatabaseId extends Object
Represents an id of a Cloud Spanner database resource.
  • Method Details

    • getInstanceId

      public InstanceId getInstanceId()
      Returns the instance id for this database.
    • getDatabase

      public String getDatabase()
      Returns the database id.
    • getName

      public String getName()
      Returns the name of this database.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • of

      public static DatabaseId of(String name)
      Creates a DatabaseId from the name of the database.
      Parameters:
      name - the database name of the form projects/PROJECT_ID/instances/INSTANCE_ID/databases/DATABASE_ID
      Throws:
      IllegalArgumentException - if name does not conform to the expected pattern
    • of

      public static DatabaseId of(String project, String instance, String database)
      Creates a DatabaseId given project, instance and database IDs.
    • of

      public static DatabaseId of(InstanceId instanceId, String database)
      Creates a DatabaseId given the instance identity and database id.