/** * * * <pre> * The collection ids. * </pre> * * <code>repeated string collection_ids = 1;</code> */ public Builder addCollectionIdsBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); ensureCollectionIdsIsMutable(); collectionIds_.add(value); onChanged(); return this; }
@java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.firestore.v1beta1.ListCollectionIdsResponse parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.firestore.v1beta1.ListCollectionIdsResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; }
public Builder mergeFrom(com.google.firestore.v1beta1.ListCollectionIdsResponse other) { if (other == com.google.firestore.v1beta1.ListCollectionIdsResponse.getDefaultInstance()) return this; if (!other.collectionIds_.isEmpty()) { if (collectionIds_.isEmpty()) { collectionIds_ = other.collectionIds_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureCollectionIdsIsMutable(); collectionIds_.addAll(other.collectionIds_); } onChanged(); } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void listCollectionIdsTest() { String nextPageToken = ""; String collectionIdsElement = "collectionIdsElement1368994900"; List<String> collectionIds = Arrays.asList(collectionIdsElement); ListCollectionIdsResponse expectedResponse = ListCollectionIdsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllCollectionIds(collectionIds) .build(); mockFirestore.addResponse(expectedResponse); String formattedParent = FirestoreClient.formatAnyPathName("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]"); ListCollectionIdsPagedResponse pagedListResponse = client.listCollectionIds(formattedParent); List<String> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getCollectionIdsList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockFirestore.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListCollectionIdsRequest actualRequest = (ListCollectionIdsRequest) actualRequests.get(0); Assert.assertEquals(formattedParent, actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
/** * * * <pre> * The collection ids. * </pre> * * <code>repeated string collection_ids = 1;</code> */ public Builder setCollectionIds(int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureCollectionIdsIsMutable(); collectionIds_.set(index, value); onChanged(); return this; } /**
/** * * * <pre> * The collection ids. * </pre> * * <code>repeated string collection_ids = 1;</code> */ public Builder addCollectionIds(java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureCollectionIdsIsMutable(); collectionIds_.add(value); onChanged(); return this; } /**
@java.lang.Override public com.google.firestore.v1beta1.ListCollectionIdsResponse buildPartial() { com.google.firestore.v1beta1.ListCollectionIdsResponse result = new com.google.firestore.v1beta1.ListCollectionIdsResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { collectionIds_ = collectionIds_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000001); } result.collectionIds_ = collectionIds_; result.nextPageToken_ = nextPageToken_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
/** * * * <pre> * The collection ids. * </pre> * * <code>repeated string collection_ids = 1;</code> */ public Builder addAllCollectionIds(java.lang.Iterable<java.lang.String> values) { ensureCollectionIdsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, collectionIds_); onChanged(); return this; } /**
private Builder() { maybeForceBuilderInitialization(); }
public static Builder newBuilder( com.google.firestore.v1beta1.ListCollectionIdsResponse prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); }
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); }
@java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.firestore.v1beta1.ListCollectionIdsResponse) { return mergeFrom((com.google.firestore.v1beta1.ListCollectionIdsResponse) other); } else { super.mergeFrom(other); return this; } }
@java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /**
@java.lang.Override public com.google.firestore.v1beta1.ListCollectionIdsResponse build() { com.google.firestore.v1beta1.ListCollectionIdsResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }