Class Key (2.26.4)

publicfinalclass KeyextendsGeneratedMessageV3implementsKeyOrBuilder

A unique identifier for an entity. If a key's partition ID or any of its path kinds or names are reserved/read-only, the key is reserved/read-only. A reserved/read-only key is forbidden in certain documented contexts.

Protobuf type google.datastore.v1.Key

Implements

KeyOrBuilder

Inherited Members

com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT)
com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT,int)
com.google.protobuf.GeneratedMessageV3.<T>emptyList(java.lang.Class<T>)
com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int)

Static Fields

PARTITION_ID_FIELD_NUMBER

publicstaticfinalintPARTITION_ID_FIELD_NUMBER
Field Value
Type Description
int

PATH_FIELD_NUMBER

publicstaticfinalintPATH_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

publicstaticKeygetDefaultInstance()
Returns
Type Description
Key

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

newBuilder()

publicstaticKey.BuildernewBuilder()
Returns
Type Description
Key.Builder

newBuilder(Key prototype)

publicstaticKey.BuildernewBuilder(Keyprototype)
Parameter
Name Description
prototype Key
Returns
Type Description
Key.Builder

parseDelimitedFrom(InputStream input)

publicstaticKeyparseDelimitedFrom(InputStreaminput)
Parameter
Name Description
input InputStream
Returns
Type Description
Key
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticKeyparseDelimitedFrom(InputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Key
Exceptions
Type Description
IOException

parseFrom(byte[] data)

publicstaticKeyparseFrom(byte[]data)
Parameter
Name Description
data byte[]
Returns
Type Description
Key
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

publicstaticKeyparseFrom(byte[]data,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Key
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

publicstaticKeyparseFrom(ByteStringdata)
Parameter
Name Description
data ByteString
Returns
Type Description
Key
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

publicstaticKeyparseFrom(ByteStringdata,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Key
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

publicstaticKeyparseFrom(CodedInputStreaminput)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Key
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticKeyparseFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Key
Exceptions
Type Description
IOException

parseFrom(InputStream input)

publicstaticKeyparseFrom(InputStreaminput)
Parameter
Name Description
input InputStream
Returns
Type Description
Key
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticKeyparseFrom(InputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Key
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

publicstaticKeyparseFrom(ByteBufferdata)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Key
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

publicstaticKeyparseFrom(ByteBufferdata,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Key
Exceptions
Type Description
InvalidProtocolBufferException

parser()

publicstaticParser<Key>parser()
Returns
Type Description
Parser<Key>

Methods

equals(Object obj)

publicbooleanequals(Objectobj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getDefaultInstanceForType()

publicKeygetDefaultInstanceForType()
Returns
Type Description
Key

getParserForType()

publicParser<Key>getParserForType()
Returns
Type Description
Parser<Key>
Overrides

getPartitionId()

publicPartitionIdgetPartitionId()

Entities are partitioned into subsets, currently identified by a project ID and namespace ID. Queries are scoped to a single partition.

.google.datastore.v1.PartitionId partition_id = 1;

Returns
Type Description
PartitionId

The partitionId.

getPartitionIdOrBuilder()

publicPartitionIdOrBuildergetPartitionIdOrBuilder()

Entities are partitioned into subsets, currently identified by a project ID and namespace ID. Queries are scoped to a single partition.

.google.datastore.v1.PartitionId partition_id = 1;

Returns
Type Description
PartitionIdOrBuilder

getPath(int index)

publicKey.PathElementgetPath(intindex)

The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element identifies a root entity, the second element identifies a child of the root entity, the third element identifies a child of the second entity, and so forth. The entities identified by all prefixes of the path are called the element's ancestors.

An entity path is always fully complete: all of the entity's ancestors are required to be in the path along with the entity identifier itself. The only exception is that in some documented cases, the identifier in the last path element (for the entity) itself may be omitted. For example, the last path element of the key of Mutation.insert may have no identifier.

A path can never be empty, and a path can have at most 100 elements.

repeated .google.datastore.v1.Key.PathElement path = 2;

Parameter
Name Description
index int
Returns
Type Description
Key.PathElement

getPathCount()

publicintgetPathCount()

The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element identifies a root entity, the second element identifies a child of the root entity, the third element identifies a child of the second entity, and so forth. The entities identified by all prefixes of the path are called the element's ancestors.

An entity path is always fully complete: all of the entity's ancestors are required to be in the path along with the entity identifier itself. The only exception is that in some documented cases, the identifier in the last path element (for the entity) itself may be omitted. For example, the last path element of the key of Mutation.insert may have no identifier.

A path can never be empty, and a path can have at most 100 elements.

repeated .google.datastore.v1.Key.PathElement path = 2;

Returns
Type Description
int

getPathList()

publicList<Key.PathElement>getPathList()

The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element identifies a root entity, the second element identifies a child of the root entity, the third element identifies a child of the second entity, and so forth. The entities identified by all prefixes of the path are called the element's ancestors.

An entity path is always fully complete: all of the entity's ancestors are required to be in the path along with the entity identifier itself. The only exception is that in some documented cases, the identifier in the last path element (for the entity) itself may be omitted. For example, the last path element of the key of Mutation.insert may have no identifier.

A path can never be empty, and a path can have at most 100 elements.

repeated .google.datastore.v1.Key.PathElement path = 2;

Returns
Type Description
List<PathElement>

getPathOrBuilder(int index)

publicKey.PathElementOrBuildergetPathOrBuilder(intindex)

The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element identifies a root entity, the second element identifies a child of the root entity, the third element identifies a child of the second entity, and so forth. The entities identified by all prefixes of the path are called the element's ancestors.

An entity path is always fully complete: all of the entity's ancestors are required to be in the path along with the entity identifier itself. The only exception is that in some documented cases, the identifier in the last path element (for the entity) itself may be omitted. For example, the last path element of the key of Mutation.insert may have no identifier.

A path can never be empty, and a path can have at most 100 elements.

repeated .google.datastore.v1.Key.PathElement path = 2;

Parameter
Name Description
index int
Returns
Type Description
Key.PathElementOrBuilder

getPathOrBuilderList()

publicList<?extendsKey.PathElementOrBuilder>getPathOrBuilderList()

The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element identifies a root entity, the second element identifies a child of the root entity, the third element identifies a child of the second entity, and so forth. The entities identified by all prefixes of the path are called the element's ancestors.

An entity path is always fully complete: all of the entity's ancestors are required to be in the path along with the entity identifier itself. The only exception is that in some documented cases, the identifier in the last path element (for the entity) itself may be omitted. For example, the last path element of the key of Mutation.insert may have no identifier.

A path can never be empty, and a path can have at most 100 elements.

repeated .google.datastore.v1.Key.PathElement path = 2;

Returns
Type Description
List<? extends com.google.datastore.v1.Key.PathElementOrBuilder>

getSerializedSize()

publicintgetSerializedSize()
Returns
Type Description
int
Overrides

hasPartitionId()

publicbooleanhasPartitionId()

Entities are partitioned into subsets, currently identified by a project ID and namespace ID. Queries are scoped to a single partition.

.google.datastore.v1.PartitionId partition_id = 1;

Returns
Type Description
boolean

Whether the partitionId field is set.

hashCode()

publicinthashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

publicKey.BuildernewBuilderForType()
Returns
Type Description
Key.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protectedKey.BuildernewBuilderForType(GeneratedMessageV3.BuilderParentparent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Key.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protectedObjectnewInstance(GeneratedMessageV3.UnusedPrivateParameterunused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

publicKey.BuildertoBuilder()
Returns
Type Description
Key.Builder

writeTo(CodedOutputStream output)

publicvoidwriteTo(CodedOutputStreamoutput)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.