Class Key.Builder (2.21.3)

publicstaticfinalclass Key.BuilderextendsGeneratedMessageV3.Builder<Key.Builder>implementsKeyOrBuilder

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.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)

Static Methods

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

Methods

addAllPath(Iterable<? extends Key.PathElement> values)

publicKey.BuilderaddAllPath(Iterable<?extendsKey.PathElement>values)

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
values Iterable<? extends com.google.datastore.v1.Key.PathElement>
Returns
Type Description
Key.Builder

addPath(Key.PathElement value)

publicKey.BuilderaddPath(Key.PathElementvalue)

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
value Key.PathElement
Returns
Type Description
Key.Builder

addPath(Key.PathElement.Builder builderForValue)

publicKey.BuilderaddPath(Key.PathElement.BuilderbuilderForValue)

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
builderForValue Key.PathElement.Builder
Returns
Type Description
Key.Builder

addPath(int index, Key.PathElement value)

publicKey.BuilderaddPath(intindex,Key.PathElementvalue)

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;

Parameters
Name Description
index int
value Key.PathElement
Returns
Type Description
Key.Builder

addPath(int index, Key.PathElement.Builder builderForValue)

publicKey.BuilderaddPath(intindex,Key.PathElement.BuilderbuilderForValue)

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;

Parameters
Name Description
index int
builderForValue Key.PathElement.Builder
Returns
Type Description
Key.Builder

addPathBuilder()

publicKey.PathElement.BuilderaddPathBuilder()

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
Key.PathElement.Builder

addPathBuilder(int index)

publicKey.PathElement.BuilderaddPathBuilder(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.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

publicKey.BuilderaddRepeatedField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Key.Builder
Overrides

build()

publicKeybuild()
Returns
Type Description
Key

buildPartial()

publicKeybuildPartial()
Returns
Type Description
Key

clear()

publicKey.Builderclear()
Returns
Type Description
Key.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

publicKey.BuilderclearField(Descriptors.FieldDescriptorfield)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
Key.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

publicKey.BuilderclearOneof(Descriptors.OneofDescriptoroneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
Key.Builder
Overrides

clearPartitionId()

publicKey.BuilderclearPartitionId()

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
Key.Builder

clearPath()

publicKey.BuilderclearPath()

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
Key.Builder

clone()

publicKey.Builderclone()
Returns
Type Description
Key.Builder
Overrides

getDefaultInstanceForType()

publicKeygetDefaultInstanceForType()
Returns
Type Description
Key

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Descriptor
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.

getPartitionIdBuilder()

publicPartitionId.BuildergetPartitionIdBuilder()

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.Builder

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

getPathBuilder(int index)

publicKey.PathElement.BuildergetPathBuilder(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.Builder

getPathBuilderList()

publicList<Key.PathElement.Builder>getPathBuilderList()

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<Builder>

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>

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.

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(Key other)

publicKey.BuildermergeFrom(Keyother)
Parameter
Name Description
other Key
Returns
Type Description
Key.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicKey.BuildermergeFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Key.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

publicKey.BuildermergeFrom(Messageother)
Parameter
Name Description
other Message
Returns
Type Description
Key.Builder
Overrides

mergePartitionId(PartitionId value)

publicKey.BuildermergePartitionId(PartitionIdvalue)

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;

Parameter
Name Description
value PartitionId
Returns
Type Description
Key.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

publicfinalKey.BuildermergeUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Key.Builder
Overrides

removePath(int index)

publicKey.BuilderremovePath(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.Builder

setField(Descriptors.FieldDescriptor field, Object value)

publicKey.BuildersetField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Key.Builder
Overrides

setPartitionId(PartitionId value)

publicKey.BuildersetPartitionId(PartitionIdvalue)

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;

Parameter
Name Description
value PartitionId
Returns
Type Description
Key.Builder

setPartitionId(PartitionId.Builder builderForValue)

publicKey.BuildersetPartitionId(PartitionId.BuilderbuilderForValue)

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;

Parameter
Name Description
builderForValue PartitionId.Builder
Returns
Type Description
Key.Builder

setPath(int index, Key.PathElement value)

publicKey.BuildersetPath(intindex,Key.PathElementvalue)

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;

Parameters
Name Description
index int
value Key.PathElement
Returns
Type Description
Key.Builder

setPath(int index, Key.PathElement.Builder builderForValue)

publicKey.BuildersetPath(intindex,Key.PathElement.BuilderbuilderForValue)

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;

Parameters
Name Description
index int
builderForValue Key.PathElement.Builder
Returns
Type Description
Key.Builder

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

publicKey.BuildersetRepeatedField(Descriptors.FieldDescriptorfield,intindex,Objectvalue)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
Key.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

publicfinalKey.BuildersetUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Key.Builder
Overrides

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.