com.google.datastore.v1.Key.hasPartitionId()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中com.google.datastore.v1.Key.hasPartitionId()方法的一些代码示例,展示了Key.hasPartitionId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Key.hasPartitionId()方法的具体详情如下:
包路径:com.google.datastore.v1.Key
类名称:Key
方法名:hasPartitionId

Key.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;`
[中]```
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;

代码示例

代码示例来源:origin: googleapis/google-cloud-java

@java.lang.Override
public boolean equals(final java.lang.Object obj) {
 if (obj == this) {
  return true;
 }
 if (!(obj instanceof com.google.datastore.v1.Key)) {
  return super.equals(obj);
 }
 com.google.datastore.v1.Key other = (com.google.datastore.v1.Key) obj;
 boolean result = true;
 result = result && (hasPartitionId() == other.hasPartitionId());
 if (hasPartitionId()) {
  result = result && getPartitionId().equals(other.getPartitionId());
 }
 result = result && getPathList().equals(other.getPathList());
 result = result && unknownFields.equals(other.unknownFields);
 return result;
}

代码示例来源:origin: googleapis/google-cloud-java

@java.lang.Override
public int hashCode() {
 if (memoizedHashCode != 0) {
  return memoizedHashCode;
 }
 int hash = 41;
 hash = (19 * hash) + getDescriptor().hashCode();
 if (hasPartitionId()) {
  hash = (37 * hash) + PARTITION_ID_FIELD_NUMBER;
  hash = (53 * hash) + getPartitionId().hashCode();
 }
 if (getPathCount() > 0) {
  hash = (37 * hash) + PATH_FIELD_NUMBER;
  hash = (53 * hash) + getPathList().hashCode();
 }
 hash = (29 * hash) + unknownFields.hashCode();
 memoizedHashCode = hash;
 return hash;
}

代码示例来源:origin: googleapis/google-cloud-java

static IncompleteKey fromPb(com.google.datastore.v1.Key keyPb) {
 String projectId = "";
 String namespace = "";
 if (keyPb.hasPartitionId()) {
  com.google.datastore.v1.PartitionId partitionIdPb = keyPb.getPartitionId();
  projectId = partitionIdPb.getProjectId();
  namespace = partitionIdPb.getNamespaceId();
 }
 List<com.google.datastore.v1.Key.PathElement> pathElementsPb = keyPb.getPathList();
 Preconditions.checkArgument(!pathElementsPb.isEmpty(), "Path must not be empty");
 ImmutableList.Builder<PathElement> pathBuilder = ImmutableList.builder();
 for (com.google.datastore.v1.Key.PathElement pathElementPb : pathElementsPb) {
  pathBuilder.add(PathElement.fromPb(pathElementPb));
 }
 ImmutableList<PathElement> path = pathBuilder.build();
 PathElement leaf = path.get(path.size() - 1);
 if (leaf.getNameOrId() != null) {
  return new Key(projectId, namespace, path);
 }
 return new IncompleteKey(projectId, namespace, path);
}

代码示例来源:origin: googleapis/google-cloud-java

public Builder mergeFrom(com.google.datastore.v1.Key other) {
 if (other == com.google.datastore.v1.Key.getDefaultInstance()) return this;
 if (other.hasPartitionId()) {
  mergePartitionId(other.getPartitionId());

代码示例来源:origin: com.google.api.grpc/proto-google-cloud-datastore-v1

@java.lang.Override
public boolean equals(final java.lang.Object obj) {
 if (obj == this) {
  return true;
 }
 if (!(obj instanceof com.google.datastore.v1.Key)) {
  return super.equals(obj);
 }
 com.google.datastore.v1.Key other = (com.google.datastore.v1.Key) obj;
 boolean result = true;
 result = result && (hasPartitionId() == other.hasPartitionId());
 if (hasPartitionId()) {
  result = result && getPartitionId().equals(other.getPartitionId());
 }
 result = result && getPathList().equals(other.getPathList());
 result = result && unknownFields.equals(other.unknownFields);
 return result;
}

代码示例来源:origin: com.google.cloud.datastore/datastore-v1-protos

@java.lang.Override
public boolean equals(final java.lang.Object obj) {
 if (obj == this) {
  return true;
 }
 if (!(obj instanceof com.google.datastore.v1.Key)) {
  return super.equals(obj);
 }
 com.google.datastore.v1.Key other = (com.google.datastore.v1.Key) obj;
 boolean result = true;
 result = result && (hasPartitionId() == other.hasPartitionId());
 if (hasPartitionId()) {
  result = result && getPartitionId()
    .equals(other.getPartitionId());
 }
 result = result && getPathList()
   .equals(other.getPathList());
 return result;
}

代码示例来源:origin: com.google.cloud.datastore/datastore-v1-protos

@java.lang.Override
public int hashCode() {
 if (memoizedHashCode != 0) {
  return memoizedHashCode;
 }
 int hash = 41;
 hash = (19 * hash) + getDescriptorForType().hashCode();
 if (hasPartitionId()) {
  hash = (37 * hash) + PARTITION_ID_FIELD_NUMBER;
  hash = (53 * hash) + getPartitionId().hashCode();
 }
 if (getPathCount() > 0) {
  hash = (37 * hash) + PATH_FIELD_NUMBER;
  hash = (53 * hash) + getPathList().hashCode();
 }
 hash = (29 * hash) + unknownFields.hashCode();
 memoizedHashCode = hash;
 return hash;
}

代码示例来源:origin: com.google.api.grpc/proto-google-cloud-datastore-v1

@java.lang.Override
public int hashCode() {
 if (memoizedHashCode != 0) {
  return memoizedHashCode;
 }
 int hash = 41;
 hash = (19 * hash) + getDescriptor().hashCode();
 if (hasPartitionId()) {
  hash = (37 * hash) + PARTITION_ID_FIELD_NUMBER;
  hash = (53 * hash) + getPartitionId().hashCode();
 }
 if (getPathCount() > 0) {
  hash = (37 * hash) + PATH_FIELD_NUMBER;
  hash = (53 * hash) + getPathList().hashCode();
 }
 hash = (29 * hash) + unknownFields.hashCode();
 memoizedHashCode = hash;
 return hash;
}

代码示例来源:origin: com.google.cloud/google-cloud-datastore

static IncompleteKey fromPb(com.google.datastore.v1.Key keyPb) {
 String projectId = "";
 String namespace = "";
 if (keyPb.hasPartitionId()) {
  com.google.datastore.v1.PartitionId partitionIdPb = keyPb.getPartitionId();
  projectId = partitionIdPb.getProjectId();
  namespace = partitionIdPb.getNamespaceId();
 }
 List<com.google.datastore.v1.Key.PathElement> pathElementsPb = keyPb.getPathList();
 Preconditions.checkArgument(!pathElementsPb.isEmpty(), "Path must not be empty");
 ImmutableList.Builder<PathElement> pathBuilder = ImmutableList.builder();
 for (com.google.datastore.v1.Key.PathElement pathElementPb : pathElementsPb) {
  pathBuilder.add(PathElement.fromPb(pathElementPb));
 }
 ImmutableList<PathElement> path = pathBuilder.build();
 PathElement leaf = path.get(path.size() - 1);
 if (leaf.getNameOrId() != null) {
  return new Key(projectId, namespace, path);
 }
 return new IncompleteKey(projectId, namespace, path);
}

代码示例来源:origin: com.google.cloud.datastore/datastore-v1-protos

public Builder mergeFrom(com.google.datastore.v1.Key other) {
 if (other == com.google.datastore.v1.Key.getDefaultInstance()) return this;
 if (other.hasPartitionId()) {
  mergePartitionId(other.getPartitionId());

代码示例来源:origin: com.google.api.grpc/proto-google-cloud-datastore-v1

public Builder mergeFrom(com.google.datastore.v1.Key other) {
 if (other == com.google.datastore.v1.Key.getDefaultInstance()) return this;
 if (other.hasPartitionId()) {
  mergePartitionId(other.getPartitionId());

相关文章