/** * * * <pre> * The name of the topic. It must have the format * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent * signs (`%`). It must be between 3 and 255 characters in length, and it * must not start with `"goog"`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public com.google.pubsub.v1.Topic buildPartial() { com.google.pubsub.v1.Topic result = new com.google.pubsub.v1.Topic(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.name_ = name_; result.labels_ = internalGetLabels(); result.labels_.makeImmutable(); if (messageStoragePolicyBuilder_ == null) { result.messageStoragePolicy_ = messageStoragePolicy_; } else { result.messageStoragePolicy_ = messageStoragePolicyBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 2); if (messageStoragePolicy_ != null) { output.writeMessage(3, getMessageStoragePolicy()); } unknownFields.writeTo(output); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.Topic)) { return super.equals(obj); } com.google.pubsub.v1.Topic other = (com.google.pubsub.v1.Topic) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && internalGetLabels().equals(other.internalGetLabels()); result = result && (hasMessageStoragePolicy() == other.hasMessageStoragePolicy()); if (hasMessageStoragePolicy()) { result = result && getMessageStoragePolicy().equals(other.getMessageStoragePolicy()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public com.google.pubsub.v1.Topic getDefaultInstanceForType() { return com.google.pubsub.v1.Topic.getDefaultInstance(); }
public Builder mergeFrom(com.google.pubsub.v1.Topic other) { if (other == com.google.pubsub.v1.Topic.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); if (other.hasMessageStoragePolicy()) { mergeMessageStoragePolicy(other.getMessageStoragePolicy()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void createTopicTest() { ProjectTopicName name2 = ProjectTopicName.of("[PROJECT]", "[TOPIC]"); Topic expectedResponse = Topic.newBuilder().setName(name2.toString()).build(); mockPublisher.addResponse(expectedResponse); ProjectTopicName name = ProjectTopicName.of("[PROJECT]", "[TOPIC]"); Topic actualResponse = client.createTopic(name); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); Topic actualRequest = (Topic) actualRequests.get(0); Assert.assertEquals(name, ProjectTopicName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.Topic)) { return super.equals(obj); } com.google.pubsub.v1.Topic other = (com.google.pubsub.v1.Topic) obj; boolean result = true; result = result && getName() .equals(other.getName()); return result; }
public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public com.google.pubsub.v1.Topic build() { com.google.pubsub.v1.Topic result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
input.readMessage(com.google.pubsub.v1.Topic.parser(), extensionRegistry)); break;
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } }
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
e).setUnfinishedMessage(this); } finally { makeExtensionsImmutable();
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); if (!internalGetLabels().getMap().isEmpty()) { hash = (37 * hash) + LABELS_FIELD_NUMBER; hash = (53 * hash) + internalGetLabels().hashCode(); } if (hasMessageStoragePolicy()) { hash = (37 * hash) + MESSAGE_STORAGE_POLICY_FIELD_NUMBER; hash = (53 * hash) + getMessageStoragePolicy().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * The updated topic object. * </pre> * * <code>.google.pubsub.v1.Topic topic = 1;</code> */ public com.google.pubsub.v1.Topic getTopic() { return topic_ == null ? com.google.pubsub.v1.Topic.getDefaultInstance() : topic_; } /**
public Builder mergeFrom(com.google.pubsub.v1.Topic other) { if (other == com.google.pubsub.v1.Topic.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); if (other.hasMessageStoragePolicy()) { mergeMessageStoragePolicy(other.getMessageStoragePolicy()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }