Package com.google.cloud.spanner
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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getDatabase()
Returns the database id.InstanceId
getInstanceId()
Returns the instance id for this database.String
getName()
Returns the name of this database.int
hashCode()
static DatabaseId
of(InstanceId instanceId, String database)
Creates aDatabaseId
given the instance identity and database id.static DatabaseId
of(String name)
Creates aDatabaseId
from the name of the database.static DatabaseId
of(String project, String instance, String database)
Creates aDatabaseId
given project, instance and database IDs.String
toString()
-
-
-
Method Detail
-
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.
-
of
public static DatabaseId of(String name)
Creates aDatabaseId
from the name of the database.- Parameters:
name
- the database name of the formprojects/PROJECT_ID/instances/INSTANCE_ID/databases/DATABASE_ID
- Throws:
IllegalArgumentException
- ifname
does not conform to the expected pattern
-
of
public static DatabaseId of(String project, String instance, String database)
Creates aDatabaseId
given project, instance and database IDs.
-
of
public static DatabaseId of(InstanceId instanceId, String database)
Creates aDatabaseId
given the instance identity and database id.
-
-