/*
 * Copyright 2025 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/pubsub/v1/pubsub.proto

// Protobuf Java Version: 3.25.8
package com.google.pubsub.v1;

/**
 *
 *
 * <pre>
 * A subscription resource. If none of `push_config`, `bigquery_config`, or
 * `cloud_storage_config` is set, then the subscriber will pull and ack messages
 * using API methods. At most one of these fields may be set.
 * </pre>
 *
 * Protobuf type {@code google.pubsub.v1.Subscription}
 */
public final class Subscription extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.pubsub.v1.Subscription)
    SubscriptionOrBuilder {
  private static final long serialVersionUID = 0L;

  // Use Subscription.newBuilder() to construct.
  private Subscription(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private Subscription() {
    name_ = "";
    topic_ = "";
    filter_ = "";
    state_ = 0;
    messageTransforms_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new Subscription();
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.pubsub.v1.PubsubProto
        .internal_static_google_pubsub_v1_Subscription_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  @java.lang.Override
  protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection(
      int number) {
    switch (number) {
      case 9:
        return internalGetLabels();
      case 26:
        return internalGetTags();
      default:
        throw new RuntimeException("Invalid map field number: " + number);
    }
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.pubsub.v1.PubsubProto
        .internal_static_google_pubsub_v1_Subscription_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.pubsub.v1.Subscription.class,
            com.google.pubsub.v1.Subscription.Builder.class);
  }

  /**
   *
   *
   * <pre>
   * Possible states for a subscription.
   * </pre>
   *
   * Protobuf enum {@code google.pubsub.v1.Subscription.State}
   */
  public enum State implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * Default value. This value is unused.
     * </pre>
     *
     * <code>STATE_UNSPECIFIED = 0;</code>
     */
    STATE_UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * The subscription can actively receive messages
     * </pre>
     *
     * <code>ACTIVE = 1;</code>
     */
    ACTIVE(1),
    /**
     *
     *
     * <pre>
     * The subscription cannot receive messages because of an error with the
     * resource to which it pushes messages. See the more detailed error state
     * in the corresponding configuration.
     * </pre>
     *
     * <code>RESOURCE_ERROR = 2;</code>
     */
    RESOURCE_ERROR(2),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * Default value. This value is unused.
     * </pre>
     *
     * <code>STATE_UNSPECIFIED = 0;</code>
     */
    public static final int STATE_UNSPECIFIED_VALUE = 0;

    /**
     *
     *
     * <pre>
     * The subscription can actively receive messages
     * </pre>
     *
     * <code>ACTIVE = 1;</code>
     */
    public static final int ACTIVE_VALUE = 1;

    /**
     *
     *
     * <pre>
     * The subscription cannot receive messages because of an error with the
     * resource to which it pushes messages. See the more detailed error state
     * in the corresponding configuration.
     * </pre>
     *
     * <code>RESOURCE_ERROR = 2;</code>
     */
    public static final int RESOURCE_ERROR_VALUE = 2;

    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static State valueOf(int value) {
      return forNumber(value);
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     */
    public static State forNumber(int value) {
      switch (value) {
        case 0:
          return STATE_UNSPECIFIED;
        case 1:
          return ACTIVE;
        case 2:
          return RESOURCE_ERROR;
        default:
          return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<State> internalGetValueMap() {
      return internalValueMap;
    }

    private static final com.google.protobuf.Internal.EnumLiteMap<State> internalValueMap =
        new com.google.protobuf.Internal.EnumLiteMap<State>() {
          public State findValueByNumber(int number) {
            return State.forNumber(number);
          }
        };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalStateException(
            "Can't get the descriptor of an unrecognized enum value.");
      }
      return getDescriptor().getValues().get(ordinal());
    }

    public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
      return getDescriptor();
    }

    public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
      return com.google.pubsub.v1.Subscription.getDescriptor().getEnumTypes().get(0);
    }

    private static final State[] VALUES = values();

    public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private State(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.pubsub.v1.Subscription.State)
  }

  public interface AnalyticsHubSubscriptionInfoOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * Optional. The name of the associated Analytics Hub listing resource.
     * Pattern:
     * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
     * </pre>
     *
     * <code>
     * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The listing.
     */
    java.lang.String getListing();

    /**
     *
     *
     * <pre>
     * Optional. The name of the associated Analytics Hub listing resource.
     * Pattern:
     * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
     * </pre>
     *
     * <code>
     * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The bytes for listing.
     */
    com.google.protobuf.ByteString getListingBytes();

    /**
     *
     *
     * <pre>
     * Optional. The name of the associated Analytics Hub subscription resource.
     * Pattern:
     * "projects/{project}/locations/{location}/subscriptions/{subscription}"
     * </pre>
     *
     * <code>string subscription = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The subscription.
     */
    java.lang.String getSubscription();

    /**
     *
     *
     * <pre>
     * Optional. The name of the associated Analytics Hub subscription resource.
     * Pattern:
     * "projects/{project}/locations/{location}/subscriptions/{subscription}"
     * </pre>
     *
     * <code>string subscription = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The bytes for subscription.
     */
    com.google.protobuf.ByteString getSubscriptionBytes();
  }

  /**
   *
   *
   * <pre>
   * Information about an associated [Analytics Hub
   * subscription](https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions).
   * </pre>
   *
   * Protobuf type {@code google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo}
   */
  public static final class AnalyticsHubSubscriptionInfo
      extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo)
      AnalyticsHubSubscriptionInfoOrBuilder {
    private static final long serialVersionUID = 0L;

    // Use AnalyticsHubSubscriptionInfo.newBuilder() to construct.
    private AnalyticsHubSubscriptionInfo(
        com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private AnalyticsHubSubscriptionInfo() {
      listing_ = "";
      subscription_ = "";
    }

    @java.lang.Override
    @SuppressWarnings({"unused"})
    protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
      return new AnalyticsHubSubscriptionInfo();
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.pubsub.v1.PubsubProto
          .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.pubsub.v1.PubsubProto
          .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.class,
              com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.Builder.class);
    }

    public static final int LISTING_FIELD_NUMBER = 1;

    @SuppressWarnings("serial")
    private volatile java.lang.Object listing_ = "";

    /**
     *
     *
     * <pre>
     * Optional. The name of the associated Analytics Hub listing resource.
     * Pattern:
     * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
     * </pre>
     *
     * <code>
     * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The listing.
     */
    @java.lang.Override
    public java.lang.String getListing() {
      java.lang.Object ref = listing_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        listing_ = s;
        return s;
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. The name of the associated Analytics Hub listing resource.
     * Pattern:
     * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
     * </pre>
     *
     * <code>
     * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The bytes for listing.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getListingBytes() {
      java.lang.Object ref = listing_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        listing_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int SUBSCRIPTION_FIELD_NUMBER = 2;

    @SuppressWarnings("serial")
    private volatile java.lang.Object subscription_ = "";

    /**
     *
     *
     * <pre>
     * Optional. The name of the associated Analytics Hub subscription resource.
     * Pattern:
     * "projects/{project}/locations/{location}/subscriptions/{subscription}"
     * </pre>
     *
     * <code>string subscription = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The subscription.
     */
    @java.lang.Override
    public java.lang.String getSubscription() {
      java.lang.Object ref = subscription_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        subscription_ = s;
        return s;
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. The name of the associated Analytics Hub subscription resource.
     * Pattern:
     * "projects/{project}/locations/{location}/subscriptions/{subscription}"
     * </pre>
     *
     * <code>string subscription = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The bytes for subscription.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getSubscriptionBytes() {
      java.lang.Object ref = subscription_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        subscription_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(listing_)) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, listing_);
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(subscription_)) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 2, subscription_);
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(listing_)) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, listing_);
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(subscription_)) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, subscription_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo)) {
        return super.equals(obj);
      }
      com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo other =
          (com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) obj;

      if (!getListing().equals(other.getListing())) return false;
      if (!getSubscription().equals(other.getSubscription())) return false;
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (37 * hash) + LISTING_FIELD_NUMBER;
      hash = (53 * hash) + getListing().hashCode();
      hash = (37 * hash) + SUBSCRIPTION_FIELD_NUMBER;
      hash = (53 * hash) + getSubscription().hashCode();
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(
        com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * Information about an associated [Analytics Hub
     * subscription](https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions).
     * </pre>
     *
     * Protobuf type {@code google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo)
        com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfoOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.pubsub.v1.PubsubProto
            .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.pubsub.v1.PubsubProto
            .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.class,
                com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.Builder.class);
      }

      // Construct using com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.newBuilder()
      private Builder() {}

      private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
        super(parent);
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        listing_ = "";
        subscription_ = "";
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.pubsub.v1.PubsubProto
            .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor;
      }

      @java.lang.Override
      public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo
          getDefaultInstanceForType() {
        return com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo build() {
        com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo buildPartial() {
        com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo result =
            new com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(
          com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.listing_ = listing_;
        }
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.subscription_ = subscription_;
        }
      }

      @java.lang.Override
      public Builder clone() {
        return super.clone();
      }

      @java.lang.Override
      public Builder setField(
          com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
        return super.setField(field, value);
      }

      @java.lang.Override
      public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
        return super.clearField(field);
      }

      @java.lang.Override
      public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
        return super.clearOneof(oneof);
      }

      @java.lang.Override
      public Builder setRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          int index,
          java.lang.Object value) {
        return super.setRepeatedField(field, index, value);
      }

      @java.lang.Override
      public Builder addRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
        return super.addRepeatedField(field, value);
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) {
          return mergeFrom((com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(
          com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo other) {
        if (other
            == com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.getDefaultInstance())
          return this;
        if (!other.getListing().isEmpty()) {
          listing_ = other.listing_;
          bitField0_ |= 0x00000001;
          onChanged();
        }
        if (!other.getSubscription().isEmpty()) {
          subscription_ = other.subscription_;
          bitField0_ |= 0x00000002;
          onChanged();
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 10:
                {
                  listing_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000001;
                  break;
                } // case 10
              case 18:
                {
                  subscription_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000002;
                  break;
                } // case 18
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private java.lang.Object listing_ = "";

      /**
       *
       *
       * <pre>
       * Optional. The name of the associated Analytics Hub listing resource.
       * Pattern:
       * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
       * </pre>
       *
       * <code>
       * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
       * </code>
       *
       * @return The listing.
       */
      public java.lang.String getListing() {
        java.lang.Object ref = listing_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          listing_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * Optional. The name of the associated Analytics Hub listing resource.
       * Pattern:
       * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
       * </pre>
       *
       * <code>
       * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
       * </code>
       *
       * @return The bytes for listing.
       */
      public com.google.protobuf.ByteString getListingBytes() {
        java.lang.Object ref = listing_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          listing_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * Optional. The name of the associated Analytics Hub listing resource.
       * Pattern:
       * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
       * </pre>
       *
       * <code>
       * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
       * </code>
       *
       * @param value The listing to set.
       * @return This builder for chaining.
       */
      public Builder setListing(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        listing_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Optional. The name of the associated Analytics Hub listing resource.
       * Pattern:
       * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
       * </pre>
       *
       * <code>
       * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
       * </code>
       *
       * @return This builder for chaining.
       */
      public Builder clearListing() {
        listing_ = getDefaultInstance().getListing();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Optional. The name of the associated Analytics Hub listing resource.
       * Pattern:
       * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
       * </pre>
       *
       * <code>
       * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
       * </code>
       *
       * @param value The bytes for listing to set.
       * @return This builder for chaining.
       */
      public Builder setListingBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        listing_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

