@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
public Builder mergeFrom(com.google.datastore.v1.PartitionId other) { if (other == com.google.datastore.v1.PartitionId.getDefaultInstance()) return this; if (!other.getProjectId().isEmpty()) { projectId_ = other.projectId_; onChanged(); } if (!other.getNamespaceId().isEmpty()) { namespaceId_ = other.namespaceId_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@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; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.datastore.v1.PartitionId)) { return super.equals(obj); } com.google.datastore.v1.PartitionId other = (com.google.datastore.v1.PartitionId) obj; boolean result = true; result = result && getProjectId().equals(other.getProjectId()); result = result && getNamespaceId().equals(other.getNamespaceId()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PROJECT_ID_FIELD_NUMBER; hash = (53 * hash) + getProjectId().hashCode(); hash = (37 * hash) + NAMESPACE_ID_FIELD_NUMBER; hash = (53 * hash) + getNamespaceId().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getProjectIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, projectId_); } if (!getNamespaceIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, namespaceId_); } unknownFields.writeTo(output); }
@ProcessElement public void processElement(ProcessContext c) throws InvalidProtocolBufferException { String entityJson = c.element(); Entity.Builder entityBuilder = Entity.newBuilder(); entityJsonParser.merge(entityJson, entityBuilder); // Build entity who's key has an empty project Id. // This allows DatastoreIO to handle what project Entities are loaded into Key k = entityBuilder.build().getKey(); entityBuilder.setKey(Key.newBuilder() .addAllPath(k.getPathList()) .setPartitionId(PartitionId.newBuilder() .setProjectId("") .setNamespaceId(k.getPartitionId().getNamespaceId()))); c.output(entityBuilder.build()); } }
/** * * * <pre> * If not empty, the ID of the namespace to which the entities belong. * </pre> * * <code>string namespace_id = 4;</code> */ public Builder clearNamespaceId() { namespaceId_ = getDefaultInstance().getNamespaceId(); onChanged(); return this; } /**
@java.lang.Override public com.google.datastore.v1.PartitionId getDefaultInstanceForType() { return com.google.datastore.v1.PartitionId.getDefaultInstance(); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); hash = (37 * hash) + PROJECT_ID_FIELD_NUMBER; hash = (53 * hash) + getProjectId().hashCode(); hash = (37 * hash) + NAMESPACE_ID_FIELD_NUMBER; hash = (53 * hash) + getNamespaceId().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * The ID of the project to which the entities belong. * </pre> * * <code>string project_id = 2;</code> */ public Builder clearProjectId() { projectId_ = getDefaultInstance().getProjectId(); onChanged(); return this; } /**
if (partitionId == null) { partitionId = subKey.getPartitionId(); } else if (!partitionId.equals(subKey.getPartitionId())) { throw new IllegalArgumentException("Partition IDs did not match, found: " + partitionId + " and " + subKey.getPartitionId()); if (partitionId != null && !partitionId.equals(PartitionId.getDefaultInstance())) { key.setPartitionId(partitionId);
/** * Return the namespace for this key. * * @return the namespace. */ public String getNamespace() { return key.getPartitionId().getNamespaceId(); }
@java.lang.Override public com.google.datastore.v1.PartitionId buildPartial() { com.google.datastore.v1.PartitionId result = new com.google.datastore.v1.PartitionId(this); result.projectId_ = projectId_; result.namespaceId_ = namespaceId_; onBuilt(); return result; }
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); }
/** * <pre> * If not empty, the ID of the namespace to which the entities belong. * </pre> * * <code>optional string namespace_id = 4;</code> */ public Builder clearNamespaceId() { namespaceId_ = getDefaultInstance().getNamespaceId(); onChanged(); return this; } /**
/** * * * <pre> * Entities are partitioned into subsets, currently identified by a project * ID and namespace ID. * Queries are scoped to a single partition. * </pre> * * <code>.google.datastore.v1.PartitionId partition_id = 1;</code> */ public com.google.datastore.v1.PartitionId getPartitionId() { return partitionId_ == null ? com.google.datastore.v1.PartitionId.getDefaultInstance() : partitionId_; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PROJECT_ID_FIELD_NUMBER; hash = (53 * hash) + getProjectId().hashCode(); hash = (37 * hash) + NAMESPACE_ID_FIELD_NUMBER; hash = (53 * hash) + getNamespaceId().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * <pre> * The ID of the project to which the entities belong. * </pre> * * <code>optional string project_id = 2;</code> */ public Builder clearProjectId() { projectId_ = getDefaultInstance().getProjectId(); onChanged(); return this; } /**
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getProjectIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, projectId_); } if (!getNamespaceIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, namespaceId_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }