Package com.google.cloud.datastore
Class Key
java.lang.Object
com.google.cloud.datastore.BaseKey
com.google.cloud.datastore.IncompleteKey
com.google.cloud.datastore.Key
- All Implemented Interfaces:
Serializable
A key that is guaranteed to be complete and could be used to reference a Google Cloud Datastore
Entity. This class is immutable.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyfromUrlSafe(String urlSafe) Create aKeygiven its URL safe encoded form.getId()Returns the key's id ornullif it has a name instead.getName()Returns the key's name ornullif it has an id instead.booleanhasId()booleanhasName()static Key.BuildernewBuilder(IncompleteKey copyFrom, long id) static Key.BuildernewBuilder(IncompleteKey copyFrom, String name) static Key.BuildernewBuilder(Key copyFrom) static Key.BuildernewBuilder(Key parent, String kind, long id) static Key.BuildernewBuilder(Key parent, String kind, String name) static Key.BuildernewBuilder(String projectId, String kind, long id) static Key.BuildernewBuilder(String projectId, String kind, long id, String databaseId) static Key.BuildernewBuilder(String projectId, String kind, String name) static Key.BuildernewBuilder(String projectId, String kind, String name, String databaseId) Returns the key in an encoded form that can be used as part of a URL.Methods inherited from class com.google.cloud.datastore.IncompleteKey
getParent, newBuilder, newBuilder, newBuilder, newBuilderWithDatabaseIdMethods inherited from class com.google.cloud.datastore.BaseKey
equals, getAncestors, getDatabaseId, getKind, getNamespace, getProjectId, hashCode, toString
-
Method Details
-
hasId
public boolean hasId() -
getId
Returns the key's id ornullif it has a name instead. -
hasName
public boolean hasName() -
getName
Returns the key's name ornullif it has an id instead. -
getNameOrId
-
toUrlSafe
Returns the key in an encoded form that can be used as part of a URL. -
fromUrlSafe
Create aKeygiven its URL safe encoded form.- Throws:
IllegalArgumentException- when decoding fails
-
newBuilder
-
newBuilder
-
newBuilder
-
newBuilder
-
newBuilder
-
newBuilder
-
newBuilder
-
newBuilder
-
newBuilder
-