Class Key (2.14.1)

public final class Key extends GeneratedMessageV3 implements KeyOrBuilder

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

Static Fields

PARTITION_ID_FIELD_NUMBER

public static final int PARTITION_ID_FIELD_NUMBER
Field Value
TypeDescription
int

PATH_FIELD_NUMBER

public static final int PATH_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static Key getDefaultInstance()
Returns
TypeDescription
Key

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

newBuilder()

public static Key.Builder newBuilder()
Returns
TypeDescription
Key.Builder

newBuilder(Key prototype)

public static Key.Builder newBuilder(Key prototype)
Parameter
NameDescription
prototypeKey
Returns
TypeDescription
Key.Builder

parseDelimitedFrom(InputStream input)

public static Key parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Key
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Key parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Key
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static Key parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
Key
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Key parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Key
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Key parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
Key
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Key parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Key
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Key parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
Key
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Key parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Key
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static Key parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Key
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Key parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Key
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static Key parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
Key
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Key parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Key
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<Key> parser()
Returns
TypeDescription
Parser<Key>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getDefaultInstanceForType()

public Key getDefaultInstanceForType()
Returns
TypeDescription
Key

getParserForType()

public Parser<Key> getParserForType()
Returns
TypeDescription
Parser<Key>
Overrides

getPartitionId()

public PartitionId getPartitionId()

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
TypeDescription
PartitionId

The partitionId.

getPartitionIdOrBuilder()

public PartitionIdOrBuilder getPartitionIdOrBuilder()

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
TypeDescription
PartitionIdOrBuilder

getPath(int index)

public Key.PathElement getPath(int index)

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
NameDescription
indexint
Returns
TypeDescription
Key.PathElement

getPathCount()

public int getPathCount()

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
TypeDescription
int

getPathList()

public List<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
TypeDescription
List<PathElement>

getPathOrBuilder(int index)

public Key.PathElementOrBuilder getPathOrBuilder(int index)

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
NameDescription
indexint
Returns
TypeDescription
Key.PathElementOrBuilder

getPathOrBuilderList()

public List<? extends Key.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
TypeDescription
List<? extends com.google.datastore.v1.Key.PathElementOrBuilder>

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

getUnknownFields()

public final UnknownFieldSet getUnknownFields()
Returns
TypeDescription
UnknownFieldSet
Overrides

hasPartitionId()

public boolean hasPartitionId()

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
TypeDescription
boolean

Whether the partitionId field is set.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

public Key.Builder newBuilderForType()
Returns
TypeDescription
Key.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Key.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
Key.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

public Key.Builder toBuilder()
Returns
TypeDescription
Key.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides
Exceptions
TypeDescription
IOException