/*
 * 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>
 * All supported message transforms types.
 * </pre>
 *
 * Protobuf type {@code google.pubsub.v1.MessageTransform}
 */
public final class MessageTransform extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.pubsub.v1.MessageTransform)
    MessageTransformOrBuilder {
  private static final long serialVersionUID = 0L;

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

  private MessageTransform() {}

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

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

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

  private int transformCase_ = 0;

  @SuppressWarnings("serial")
  private java.lang.Object transform_;

  public enum TransformCase
      implements
          com.google.protobuf.Internal.EnumLite,
          com.google.protobuf.AbstractMessage.InternalOneOfEnum {
    JAVASCRIPT_UDF(2),
    TRANSFORM_NOT_SET(0);
    private final int value;

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

    /**
     * @param value The number of the enum to look for.
     * @return The enum associated with the given number.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static TransformCase valueOf(int value) {
      return forNumber(value);
    }

    public static TransformCase forNumber(int value) {
      switch (value) {
        case 2:
          return JAVASCRIPT_UDF;
        case 0:
          return TRANSFORM_NOT_SET;
        default:
          return null;
      }
    }

    public int getNumber() {
      return this.value;
    }
  };

  public TransformCase getTransformCase() {
    return TransformCase.forNumber(transformCase_);
  }

  public static final int JAVASCRIPT_UDF_FIELD_NUMBER = 2;

  /**
   *
   *
   * <pre>
   * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
   * are specified on a resource, each must have a unique `function_name`.
   * </pre>
   *
   * <code>
   * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return Whether the javascriptUdf field is set.
   */
  @java.lang.Override
  public boolean hasJavascriptUdf() {
    return transformCase_ == 2;
  }

  /**
   *
   *
   * <pre>
   * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
   * are specified on a resource, each must have a unique `function_name`.
   * </pre>
   *
   * <code>
   * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return The javascriptUdf.
   */
  @java.lang.Override
  public com.google.pubsub.v1.JavaScriptUDF getJavascriptUdf() {
    if (transformCase_ == 2) {
      return (com.google.pubsub.v1.JavaScriptUDF) transform_;
    }
    return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance();
  }

  /**
   *
   *
   * <pre>
   * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
   * are specified on a resource, each must have a unique `function_name`.
   * </pre>
   *
   * <code>
   * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public com.google.pubsub.v1.JavaScriptUDFOrBuilder getJavascriptUdfOrBuilder() {
    if (transformCase_ == 2) {
      return (com.google.pubsub.v1.JavaScriptUDF) transform_;
    }
    return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance();
  }

  public static final int ENABLED_FIELD_NUMBER = 3;
  private boolean enabled_ = false;

  /**
   *
   *
   * <pre>
   * Optional. This field is deprecated, use the `disabled` field to disable
   * transforms.
   * </pre>
   *
   * <code>bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @deprecated google.pubsub.v1.MessageTransform.enabled is deprecated. See
   *     google/pubsub/v1/pubsub.proto;l=818
   * @return The enabled.
   */
  @java.lang.Override
  @java.lang.Deprecated
  public boolean getEnabled() {
    return enabled_;
  }

  public static final int DISABLED_FIELD_NUMBER = 4;
  private boolean disabled_ = false;

  /**
   *
   *
   * <pre>
   * Optional. If true, the transform is disabled and will not be applied to
   * messages. Defaults to `false`.
   * </pre>
   *
   * <code>bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The disabled.
   */
  @java.lang.Override
  public boolean getDisabled() {
    return disabled_;
  }

  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 (transformCase_ == 2) {
      output.writeMessage(2, (com.google.pubsub.v1.JavaScriptUDF) transform_);
    }
    if (enabled_ != false) {
      output.writeBool(3, enabled_);
    }
    if (disabled_ != false) {
      output.writeBool(4, disabled_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (transformCase_ == 2) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              2, (com.google.pubsub.v1.JavaScriptUDF) transform_);
    }
    if (enabled_ != false) {
      size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, enabled_);
    }
    if (disabled_ != false) {
      size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, disabled_);
    }
    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.MessageTransform)) {
      return super.equals(obj);
    }
    com.google.pubsub.v1.MessageTransform other = (com.google.pubsub.v1.MessageTransform) obj;

    if (getEnabled() != other.getEnabled()) return false;
    if (getDisabled() != other.getDisabled()) return false;
    if (!getTransformCase().equals(other.getTransformCase())) return false;
    switch (transformCase_) {
      case 2:
        if (!getJavascriptUdf().equals(other.getJavascriptUdf())) return false;
        break;
      case 0:
      default:
    }
    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) + ENABLED_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnabled());
    hash = (37 * hash) + DISABLED_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDisabled());
    switch (transformCase_) {
      case 2:
        hash = (37 * hash) + JAVASCRIPT_UDF_FIELD_NUMBER;
        hash = (53 * hash) + getJavascriptUdf().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static com.google.pubsub.v1.MessageTransform 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.MessageTransform parseFrom(com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.pubsub.v1.MessageTransform 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.MessageTransform parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

  public static com.google.pubsub.v1.MessageTransform 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.MessageTransform parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.pubsub.v1.MessageTransform 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.MessageTransform parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.pubsub.v1.MessageTransform 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.MessageTransform 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>
   * All supported message transforms types.
   * </pre>
   *
   * Protobuf type {@code google.pubsub.v1.MessageTransform}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.pubsub.v1.MessageTransform)
      com.google.pubsub.v1.MessageTransformOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.pubsub.v1.PubsubProto
          .internal_static_google_pubsub_v1_MessageTransform_descriptor;
    }

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

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

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      if (javascriptUdfBuilder_ != null) {
        javascriptUdfBuilder_.clear();
      }
      enabled_ = false;
      disabled_ = false;
      transformCase_ = 0;
      transform_ = null;
      return this;
    }

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

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

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

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

    private void buildPartial0(com.google.pubsub.v1.MessageTransform result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.enabled_ = enabled_;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.disabled_ = disabled_;
      }
    }

    private void buildPartialOneofs(com.google.pubsub.v1.MessageTransform result) {
      result.transformCase_ = transformCase_;
      result.transform_ = this.transform_;
      if (transformCase_ == 2 && javascriptUdfBuilder_ != null) {
        result.transform_ = javascriptUdfBuilder_.build();
      }
    }

    @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.MessageTransform) {
        return mergeFrom((com.google.pubsub.v1.MessageTransform) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.pubsub.v1.MessageTransform other) {
      if (other == com.google.pubsub.v1.MessageTransform.getDefaultInstance()) return this;
      if (other.getEnabled() != false) {
        setEnabled(other.getEnabled());
      }
      if (other.getDisabled() != false) {
        setDisabled(other.getDisabled());
      }
      switch (other.getTransformCase()) {
        case JAVASCRIPT_UDF:
          {
            mergeJavascriptUdf(other.getJavascriptUdf());
            break;
          }
        case TRANSFORM_NOT_SET:
          {
            break;
          }
      }
      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 18:
              {
                input.readMessage(getJavascriptUdfFieldBuilder().getBuilder(), extensionRegistry);
                transformCase_ = 2;
                break;
              } // case 18
            case 24:
              {
                enabled_ = input.readBool();
                bitField0_ |= 0x00000002;
                break;
              } // case 24
            case 32:
              {
                disabled_ = input.readBool();
                bitField0_ |= 0x00000004;
                break;
              } // case 32
            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 transformCase_ = 0;
    private java.lang.Object transform_;

    public TransformCase getTransformCase() {
      return TransformCase.forNumber(transformCase_);
    }

    public Builder clearTransform() {
      transformCase_ = 0;
      transform_ = null;
      onChanged();
      return this;
    }

    private int bitField0_;

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.pubsub.v1.JavaScriptUDF,
            com.google.pubsub.v1.JavaScriptUDF.Builder,
            com.google.pubsub.v1.JavaScriptUDFOrBuilder>
        javascriptUdfBuilder_;

    /**
     *
     *
     * <pre>
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     * </pre>
     *
     * <code>
     * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return Whether the javascriptUdf field is set.
     */
    @java.lang.Override
    public boolean hasJavascriptUdf() {
      return transformCase_ == 2;
    }

    /**
     *
     *
     * <pre>
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     * </pre>
     *
     * <code>
     * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The javascriptUdf.
     */
    @java.lang.Override
    public com.google.pubsub.v1.JavaScriptUDF getJavascriptUdf() {
      if (javascriptUdfBuilder_ == null) {
        if (transformCase_ == 2) {
          return (com.google.pubsub.v1.JavaScriptUDF) transform_;
        }
        return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance();
      } else {
        if (transformCase_ == 2) {
          return javascriptUdfBuilder_.getMessage();
        }
        return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance();
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     * </pre>
     *
     * <code>
     * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setJavascriptUdf(com.google.pubsub.v1.JavaScriptUDF value) {
      if (javascriptUdfBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        transform_ = value;
        onChanged();
      } else {
        javascriptUdfBuilder_.setMessage(value);
      }
      transformCase_ = 2;
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     * </pre>
     *
     * <code>
     * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setJavascriptUdf(com.google.pubsub.v1.JavaScriptUDF.Builder builderForValue) {
      if (javascriptUdfBuilder_ == null) {
        transform_ = builderForValue.build();
        onChanged();
      } else {
        javascriptUdfBuilder_.setMessage(builderForValue.build());
      }
      transformCase_ = 2;
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     * </pre>
     *
     * <code>
     * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder mergeJavascriptUdf(com.google.pubsub.v1.JavaScriptUDF value) {
      if (javascriptUdfBuilder_ == null) {
        if (transformCase_ == 2
            && transform_ != com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance()) {
          transform_ =
              com.google.pubsub.v1.JavaScriptUDF.newBuilder(
                      (com.google.pubsub.v1.JavaScriptUDF) transform_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          transform_ = value;
        }
        onChanged();
      } else {
        if (transformCase_ == 2) {
          javascriptUdfBuilder_.mergeFrom(value);
        } else {
          javascriptUdfBuilder_.setMessage(value);
        }
      }
      transformCase_ = 2;
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     * </pre>
     *
     * <code>
     * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder clearJavascriptUdf() {
      if (javascriptUdfBuilder_ == null) {
        if (transformCase_ == 2) {
          transformCase_ = 0;
          transform_ = null;
          onChanged();
        }
      } else {
        if (transformCase_ == 2) {
          transformCase_ = 0;
          transform_ = null;
        }
        javascriptUdfBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     * </pre>
     *
     * <code>
     * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.pubsub.v1.JavaScriptUDF.Builder getJavascriptUdfBuilder() {
      return getJavascriptUdfFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     * </pre>
     *
     * <code>
     * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public com.google.pubsub.v1.JavaScriptUDFOrBuilder getJavascriptUdfOrBuilder() {
      if ((transformCase_ == 2) && (javascriptUdfBuilder_ != null)) {
        return javascriptUdfBuilder_.getMessageOrBuilder();
      } else {
        if (transformCase_ == 2) {
          return (com.google.pubsub.v1.JavaScriptUDF) transform_;
        }
        return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance();
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     * </pre>
     *
     * <code>
     * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.pubsub.v1.JavaScriptUDF,
            com.google.pubsub.v1.JavaScriptUDF.Builder,
            com.google.pubsub.v1.JavaScriptUDFOrBuilder>
        getJavascriptUdfFieldBuilder() {
      if (javascriptUdfBuilder_ == null) {
        if (!(transformCase_ == 2)) {
          transform_ = com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance();
        }
        javascriptUdfBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.pubsub.v1.JavaScriptUDF,
                com.google.pubsub.v1.JavaScriptUDF.Builder,
                com.google.pubsub.v1.JavaScriptUDFOrBuilder>(
                (com.google.pubsub.v1.JavaScriptUDF) transform_, getParentForChildren(), isClean());
        transform_ = null;
      }
      transformCase_ = 2;
      onChanged();
      return javascriptUdfBuilder_;
    }

    private boolean enabled_;

    /**
     *
     *
     * <pre>
     * Optional. This field is deprecated, use the `disabled` field to disable
     * transforms.
     * </pre>
     *
     * <code>bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @deprecated google.pubsub.v1.MessageTransform.enabled is deprecated. See
     *     google/pubsub/v1/pubsub.proto;l=818
     * @return The enabled.
     */
    @java.lang.Override
    @java.lang.Deprecated
    public boolean getEnabled() {
      return enabled_;
    }

    /**
     *
     *
     * <pre>
     * Optional. This field is deprecated, use the `disabled` field to disable
     * transforms.
     * </pre>
     *
     * <code>bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @deprecated google.pubsub.v1.MessageTransform.enabled is deprecated. See
     *     google/pubsub/v1/pubsub.proto;l=818
     * @param value The enabled to set.
     * @return This builder for chaining.
     */
    @java.lang.Deprecated
    public Builder setEnabled(boolean value) {

      enabled_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. This field is deprecated, use the `disabled` field to disable
     * transforms.
     * </pre>
     *
     * <code>bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @deprecated google.pubsub.v1.MessageTransform.enabled is deprecated. See
     *     google/pubsub/v1/pubsub.proto;l=818
     * @return This builder for chaining.
     */
    @java.lang.Deprecated
    public Builder clearEnabled() {
      bitField0_ = (bitField0_ & ~0x00000002);
      enabled_ = false;
      onChanged();
      return this;
    }

    private boolean disabled_;

    /**
     *
     *
     * <pre>
     * Optional. If true, the transform is disabled and will not be applied to
     * messages. Defaults to `false`.
     * </pre>
     *
     * <code>bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The disabled.
     */
    @java.lang.Override
    public boolean getDisabled() {
      return disabled_;
    }

    /**
     *
     *
     * <pre>
     * Optional. If true, the transform is disabled and will not be applied to
     * messages. Defaults to `false`.
     * </pre>
     *
     * <code>bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The disabled to set.
     * @return This builder for chaining.
     */
    public Builder setDisabled(boolean value) {

      disabled_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. If true, the transform is disabled and will not be applied to
     * messages. Defaults to `false`.
     * </pre>
     *
     * <code>bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearDisabled() {
      bitField0_ = (bitField0_ & ~0x00000004);
      disabled_ = false;
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.pubsub.v1.MessageTransform)
  }

  // @@protoc_insertion_point(class_scope:google.pubsub.v1.MessageTransform)
  private static final com.google.pubsub.v1.MessageTransform DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.pubsub.v1.MessageTransform();
  }

  public static com.google.pubsub.v1.MessageTransform getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<MessageTransform> PARSER =
      new com.google.protobuf.AbstractParser<MessageTransform>() {
        @java.lang.Override
        public MessageTransform parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
