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 booleanequals(Object o)StringgetDatabase()Returns the database id.InstanceIdgetInstanceId()Returns the instance id for this database.StringgetName()Returns the name of this database.inthashCode()static DatabaseIdof(InstanceId instanceId, String database)Creates aDatabaseIdgiven the instance identity and database id.static DatabaseIdof(String name)Creates aDatabaseIdfrom the name of the database.static DatabaseIdof(String project, String instance, String database)Creates aDatabaseIdgiven project, instance and database IDs.StringtoString()
-
-
-
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 aDatabaseIdfrom the name of the database.- Parameters:
name- the database name of the formprojects/PROJECT_ID/instances/INSTANCE_ID/databases/DATABASE_ID- Throws:
IllegalArgumentException- ifnamedoes not conform to the expected pattern
-
of
public static DatabaseId of(String project, String instance, String database)
Creates aDatabaseIdgiven project, instance and database IDs.
-
of
public static DatabaseId of(InstanceId instanceId, String database)
Creates aDatabaseIdgiven the instance identity and database id.
-
-