/** * * * <pre> * The name of the project in the form of `projects/[PROJECT_ID]`, under which * the occurrences are to be created. * </pre> * * <code>string parent = 1;</code> */ public Builder clearParent() { parent_ = getDefaultInstance().getParent(); onChanged(); return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PARENT_FIELD_NUMBER; hash = (53 * hash) + getParent().hashCode(); if (getOccurrencesCount() > 0) { hash = (37 * hash) + OCCURRENCES_FIELD_NUMBER; hash = (53 * hash) + getOccurrencesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.grafeas.v1beta1.BatchCreateOccurrencesRequest)) { return super.equals(obj); } io.grafeas.v1beta1.BatchCreateOccurrencesRequest other = (io.grafeas.v1beta1.BatchCreateOccurrencesRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && getOccurrencesList().equals(other.getOccurrencesList()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public io.grafeas.v1beta1.BatchCreateOccurrencesRequest getDefaultInstanceForType() { return io.grafeas.v1beta1.BatchCreateOccurrencesRequest.getDefaultInstance(); }
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { done = true; makeExtensionsImmutable();
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getParentBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); } for (int i = 0; i < occurrences_.size(); i++) { output.writeMessage(2, occurrences_.get(i)); } unknownFields.writeTo(output); }
@java.lang.Override public io.grafeas.v1beta1.BatchCreateOccurrencesRequest build() { io.grafeas.v1beta1.BatchCreateOccurrencesRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public io.grafeas.v1beta1.BatchCreateOccurrencesRequest buildPartial() { io.grafeas.v1beta1.BatchCreateOccurrencesRequest result = new io.grafeas.v1beta1.BatchCreateOccurrencesRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.parent_ = parent_; if (occurrencesBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { occurrences_ = java.util.Collections.unmodifiableList(occurrences_); bitField0_ = (bitField0_ & ~0x00000002); } result.occurrences_ = occurrences_; } else { result.occurrences_ = occurrencesBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@Test @SuppressWarnings("all") public void batchCreateOccurrencesTest() { BatchCreateOccurrencesResponse expectedResponse = BatchCreateOccurrencesResponse.newBuilder().build(); mockGrafeasV1Beta1.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); List<Occurrence> occurrences = new ArrayList<>(); BatchCreateOccurrencesResponse actualResponse = client.batchCreateOccurrences(parent, occurrences); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); BatchCreateOccurrencesRequest actualRequest = (BatchCreateOccurrencesRequest) actualRequests.get(0); Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); Assert.assertEquals(occurrences, actualRequest.getOccurrencesList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
io.grpc.protobuf.ProtoUtils.marshaller( io.grafeas.v1beta1.BatchCreateOccurrencesRequest .getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { done = true; makeExtensionsImmutable();
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getParentBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); } for (int i = 0; i < occurrences_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, occurrences_.get(i)); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public io.grafeas.v1beta1.BatchCreateOccurrencesRequest build() { io.grafeas.v1beta1.BatchCreateOccurrencesRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public io.grafeas.v1beta1.BatchCreateOccurrencesRequest buildPartial() { io.grafeas.v1beta1.BatchCreateOccurrencesRequest result = new io.grafeas.v1beta1.BatchCreateOccurrencesRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.parent_ = parent_; if (occurrencesBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { occurrences_ = java.util.Collections.unmodifiableList(occurrences_); bitField0_ = (bitField0_ & ~0x00000002); } result.occurrences_ = occurrences_; } else { result.occurrences_ = occurrencesBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PARENT_FIELD_NUMBER; hash = (53 * hash) + getParent().hashCode(); if (getOccurrencesCount() > 0) { hash = (37 * hash) + OCCURRENCES_FIELD_NUMBER; hash = (53 * hash) + getOccurrencesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(io.grafeas.v1beta1.BatchCreateOccurrencesRequest other) { if (other == io.grafeas.v1beta1.BatchCreateOccurrencesRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; onChanged();
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.grafeas.v1beta1.BatchCreateOccurrencesRequest)) { return super.equals(obj); } io.grafeas.v1beta1.BatchCreateOccurrencesRequest other = (io.grafeas.v1beta1.BatchCreateOccurrencesRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && getOccurrencesList().equals(other.getOccurrencesList()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * Creates new occurrences in batch. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * List<Occurrence> occurrences = new ArrayList<>(); * BatchCreateOccurrencesResponse response = grafeasV1Beta1Client.batchCreateOccurrences(parent.toString(), occurrences); * } * </code></pre> * * @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the * occurrences are to be created. * @param occurrences The occurrences to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BatchCreateOccurrencesResponse batchCreateOccurrences( String parent, List<Occurrence> occurrences) { BatchCreateOccurrencesRequest request = BatchCreateOccurrencesRequest.newBuilder() .setParent(parent) .addAllOccurrences(occurrences) .build(); return batchCreateOccurrences(request); }
@java.lang.Override public io.grafeas.v1beta1.BatchCreateOccurrencesRequest getDefaultInstanceForType() { return io.grafeas.v1beta1.BatchCreateOccurrencesRequest.getDefaultInstance(); }