/*
 * Copyright 2026 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!
// NO CHECKED-IN PROTOBUF GENCODE
// source: google/rpc/error_details.proto
// Protobuf Java Version: 4.33.2

package com.google.rpc;

/**
 *
 *
 * <pre>
 * Describes what preconditions have failed.
 *
 * For example, if an RPC failed because it required the Terms of Service to be
 * acknowledged, it could list the terms of service violation in the
 * PreconditionFailure message.
 * </pre>
 *
 * Protobuf type {@code google.rpc.PreconditionFailure}
 */
@com.google.protobuf.Generated
public final class PreconditionFailure extends com.google.protobuf.GeneratedMessage
    implements
    // @@protoc_insertion_point(message_implements:google.rpc.PreconditionFailure)
    PreconditionFailureOrBuilder {
  private static final long serialVersionUID = 0L;

  static {
    com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
        com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
        /* major= */ 4,
        /* minor= */ 33,
        /* patch= */ 2,
        /* suffix= */ "",
        "PreconditionFailure");
  }

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

  private PreconditionFailure() {
    violations_ = java.util.Collections.emptyList();
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.rpc.ErrorDetailsProto
        .internal_static_google_rpc_PreconditionFailure_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.rpc.ErrorDetailsProto
        .internal_static_google_rpc_PreconditionFailure_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.rpc.PreconditionFailure.class,
            com.google.rpc.PreconditionFailure.Builder.class);
  }

  public interface ViolationOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.rpc.PreconditionFailure.Violation)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The type of PreconditionFailure. We recommend using a service-specific
     * enum type to define the supported precondition violation subjects. For
     * example, "TOS" for "Terms of Service violation".
     * </pre>
     *
     * <code>string type = 1;</code>
     *
     * @return The type.
     */
    java.lang.String getType();

    /**
     *
     *
     * <pre>
     * The type of PreconditionFailure. We recommend using a service-specific
     * enum type to define the supported precondition violation subjects. For
     * example, "TOS" for "Terms of Service violation".
     * </pre>
     *
     * <code>string type = 1;</code>
     *
     * @return The bytes for type.
     */
    com.google.protobuf.ByteString getTypeBytes();

    /**
     *
     *
     * <pre>
     * The subject, relative to the type, that failed.
     * For example, "google.com/cloud" relative to the "TOS" type would indicate
     * which terms of service is being referenced.
     * </pre>
     *
     * <code>string subject = 2;</code>
     *
     * @return The subject.
     */
    java.lang.String getSubject();

    /**
     *
     *
     * <pre>
     * The subject, relative to the type, that failed.
     * For example, "google.com/cloud" relative to the "TOS" type would indicate
     * which terms of service is being referenced.
     * </pre>
     *
     * <code>string subject = 2;</code>
     *
     * @return The bytes for subject.
     */
    com.google.protobuf.ByteString getSubjectBytes();

    /**
     *
     *
     * <pre>
     * A description of how the precondition failed. Developers can use this
     * description to understand how to fix the failure.
     *
     * For example: "Terms of service not accepted".
     * </pre>
     *
     * <code>string description = 3;</code>
     *
     * @return The description.
     */
    java.lang.String getDescription();

    /**
     *
     *
     * <pre>
     * A description of how the precondition failed. Developers can use this
     * description to understand how to fix the failure.
     *
     * For example: "Terms of service not accepted".
     * </pre>
     *
     * <code>string description = 3;</code>
     *
     * @return The bytes for description.
     */
    com.google.protobuf.ByteString getDescriptionBytes();
  }

  /**
   *
   *
   * <pre>
   * A message type used to describe a single precondition failure.
   * </pre>
   *
   * Protobuf type {@code google.rpc.PreconditionFailure.Violation}
   */
  public static final class Violation extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.rpc.PreconditionFailure.Violation)
      ViolationOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "Violation");
    }

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

    private Violation() {
      type_ = "";
      subject_ = "";
      description_ = "";
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.rpc.ErrorDetailsProto
          .internal_static_google_rpc_PreconditionFailure_Violation_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.rpc.ErrorDetailsProto
          .internal_static_google_rpc_PreconditionFailure_Violation_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.rpc.PreconditionFailure.Violation.class,
              com.google.rpc.PreconditionFailure.Violation.Builder.class);
    }

    public static final int TYPE_FIELD_NUMBER = 1;

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

    /**
     *
     *
     * <pre>
     * The type of PreconditionFailure. We recommend using a service-specific
     * enum type to define the supported precondition violation subjects. For
     * example, "TOS" for "Terms of Service violation".
     * </pre>
     *
     * <code>string type = 1;</code>
     *
     * @return The type.
     */
    @java.lang.Override
    public java.lang.String getType() {
      java.lang.Object ref = type_;
      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();
        type_ = s;
        return s;
      }
    }

    /**
     *
     *
     * <pre>
     * The type of PreconditionFailure. We recommend using a service-specific
     * enum type to define the supported precondition violation subjects. For
     * example, "TOS" for "Terms of Service violation".
     * </pre>
     *
     * <code>string type = 1;</code>
     *
     * @return The bytes for type.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getTypeBytes() {
      java.lang.Object ref = type_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        type_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int SUBJECT_FIELD_NUMBER = 2;

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

    /**
     *
     *
     * <pre>
     * The subject, relative to the type, that failed.
     * For example, "google.com/cloud" relative to the "TOS" type would indicate
     * which terms of service is being referenced.
     * </pre>
     *
     * <code>string subject = 2;</code>
     *
     * @return The subject.
     */
    @java.lang.Override
    public java.lang.String getSubject() {
      java.lang.Object ref = subject_;
      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();
        subject_ = s;
        return s;
      }
    }

    /**
     *
     *
     * <pre>
     * The subject, relative to the type, that failed.
     * For example, "google.com/cloud" relative to the "TOS" type would indicate
     * which terms of service is being referenced.
     * </pre>
     *
     * <code>string subject = 2;</code>
     *
     * @return The bytes for subject.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getSubjectBytes() {
      java.lang.Object ref = subject_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        subject_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int DESCRIPTION_FIELD_NUMBER = 3;

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

    /**
     *
     *
     * <pre>
     * A description of how the precondition failed. Developers can use this
     * description to understand how to fix the failure.
     *
     * For example: "Terms of service not accepted".
     * </pre>
     *
     * <code>string description = 3;</code>
     *
     * @return The description.
     */
    @java.lang.Override
    public java.lang.String getDescription() {
      java.lang.Object ref = description_;
      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();
        description_ = s;
        return s;
      }
    }

    /**
     *
     *
     * <pre>
     * A description of how the precondition failed. Developers can use this
     * description to understand how to fix the failure.
     *
     * For example: "Terms of service not accepted".
     * </pre>
     *
     * <code>string description = 3;</code>
     *
     * @return The bytes for description.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getDescriptionBytes() {
      java.lang.Object ref = description_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        description_ = 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.GeneratedMessage.isStringEmpty(type_)) {
        com.google.protobuf.GeneratedMessage.writeString(output, 1, type_);
      }
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subject_)) {
        com.google.protobuf.GeneratedMessage.writeString(output, 2, subject_);
      }
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) {
        com.google.protobuf.GeneratedMessage.writeString(output, 3, description_);
      }
      getUnknownFields().writeTo(output);
    }

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

      size = 0;
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(type_)) {
        size += com.google.protobuf.GeneratedMessage.computeStringSize(1, type_);
      }
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subject_)) {
        size += com.google.protobuf.GeneratedMessage.computeStringSize(2, subject_);
      }
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) {
        size += com.google.protobuf.GeneratedMessage.computeStringSize(3, description_);
      }
      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.rpc.PreconditionFailure.Violation)) {
        return super.equals(obj);
      }
      com.google.rpc.PreconditionFailure.Violation other =
          (com.google.rpc.PreconditionFailure.Violation) obj;

      if (!getType().equals(other.getType())) return false;
      if (!getSubject().equals(other.getSubject())) return false;
      if (!getDescription().equals(other.getDescription())) 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) + TYPE_FIELD_NUMBER;
      hash = (53 * hash) + getType().hashCode();
      hash = (37 * hash) + SUBJECT_FIELD_NUMBER;
      hash = (53 * hash) + getSubject().hashCode();
      hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER;
      hash = (53 * hash) + getDescription().hashCode();
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.rpc.PreconditionFailure.Violation parseFrom(java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.rpc.PreconditionFailure.Violation parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.rpc.PreconditionFailure.Violation parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

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

    public static com.google.rpc.PreconditionFailure.Violation parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.rpc.PreconditionFailure.Violation parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.rpc.PreconditionFailure.Violation parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.rpc.PreconditionFailure.Violation parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.rpc.PreconditionFailure.Violation parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.rpc.PreconditionFailure.Violation parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.rpc.PreconditionFailure.Violation parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.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.rpc.PreconditionFailure.Violation 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.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * A message type used to describe a single precondition failure.
     * </pre>
     *
     * Protobuf type {@code google.rpc.PreconditionFailure.Violation}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.rpc.PreconditionFailure.Violation)
        com.google.rpc.PreconditionFailure.ViolationOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.rpc.ErrorDetailsProto
            .internal_static_google_rpc_PreconditionFailure_Violation_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.rpc.ErrorDetailsProto
            .internal_static_google_rpc_PreconditionFailure_Violation_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.rpc.PreconditionFailure.Violation.class,
                com.google.rpc.PreconditionFailure.Violation.Builder.class);
      }

      // Construct using com.google.rpc.PreconditionFailure.Violation.newBuilder()
      private Builder() {}

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

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

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.rpc.ErrorDetailsProto
            .internal_static_google_rpc_PreconditionFailure_Violation_descriptor;
      }

      @java.lang.Override
      public com.google.rpc.PreconditionFailure.Violation getDefaultInstanceForType() {
        return com.google.rpc.PreconditionFailure.Violation.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.rpc.PreconditionFailure.Violation build() {
        com.google.rpc.PreconditionFailure.Violation result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.rpc.PreconditionFailure.Violation buildPartial() {
        com.google.rpc.PreconditionFailure.Violation result =
            new com.google.rpc.PreconditionFailure.Violation(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(com.google.rpc.PreconditionFailure.Violation result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.type_ = type_;
        }
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.subject_ = subject_;
        }
        if (((from_bitField0_ & 0x00000004) != 0)) {
          result.description_ = description_;
        }
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.rpc.PreconditionFailure.Violation) {
          return mergeFrom((com.google.rpc.PreconditionFailure.Violation) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.rpc.PreconditionFailure.Violation other) {
        if (other == com.google.rpc.PreconditionFailure.Violation.getDefaultInstance()) return this;
        if (!other.getType().isEmpty()) {
          type_ = other.type_;
          bitField0_ |= 0x00000001;
          onChanged();
        }
        if (!other.getSubject().isEmpty()) {
          subject_ = other.subject_;
          bitField0_ |= 0x00000002;
          onChanged();
        }
        if (!other.getDescription().isEmpty()) {
          description_ = other.description_;
          bitField0_ |= 0x00000004;
          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:
                {
                  type_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000001;
                  break;
                } // case 10
              case 18:
                {
                  subject_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000002;
                  break;
                } // case 18
              case 26:
                {
                  description_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000004;
                  break;
                } // case 26
              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 type_ = "";

      /**
       *
       *
       * <pre>
       * The type of PreconditionFailure. We recommend using a service-specific
       * enum type to define the supported precondition violation subjects. For
       * example, "TOS" for "Terms of Service violation".
       * </pre>
       *
       * <code>string type = 1;</code>
       *
       * @return The type.
       */
      public java.lang.String getType() {
        java.lang.Object ref = type_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          type_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * The type of PreconditionFailure. We recommend using a service-specific
       * enum type to define the supported precondition violation subjects. For
       * example, "TOS" for "Terms of Service violation".
       * </pre>
       *
       * <code>string type = 1;</code>
       *
       * @return The bytes for type.
       */
      public com.google.protobuf.ByteString getTypeBytes() {
        java.lang.Object ref = type_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          type_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * The type of PreconditionFailure. We recommend using a service-specific
       * enum type to define the supported precondition violation subjects. For
       * example, "TOS" for "Terms of Service violation".
       * </pre>
       *
       * <code>string type = 1;</code>
       *
       * @param value The type to set.
       * @return This builder for chaining.
       */
      public Builder setType(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        type_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The type of PreconditionFailure. We recommend using a service-specific
       * enum type to define the supported precondition violation subjects. For
       * example, "TOS" for "Terms of Service violation".
       * </pre>
       *
       * <code>string type = 1;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearType() {
        type_ = getDefaultInstance().getType();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The type of PreconditionFailure. We recommend using a service-specific
       * enum type to define the supported precondition violation subjects. For
       * example, "TOS" for "Terms of Service violation".
       * </pre>
       *
       * <code>string type = 1;</code>
       *
       * @param value The bytes for type to set.
       * @return This builder for chaining.
       */
      public Builder setTypeBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        type_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      private java.lang.Object subject_ = "";

      /**
       *
       *
       * <pre>
       * The subject, relative to the type, that failed.
       * For example, "google.com/cloud" relative to the "TOS" type would indicate
       * which terms of service is being referenced.
       * </pre>
       *
       * <code>string subject = 2;</code>
       *
       * @return The subject.
       */
      public java.lang.String getSubject() {
        java.lang.Object ref = subject_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          subject_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * The subject, relative to the type, that failed.
       * For example, "google.com/cloud" relative to the "TOS" type would indicate
       * which terms of service is being referenced.
       * </pre>
       *
       * <code>string subject = 2;</code>
       *
       * @return The bytes for subject.
       */
      public com.google.protobuf.ByteString getSubjectBytes() {
        java.lang.Object ref = subject_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          subject_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * The subject, relative to the type, that failed.
       * For example, "google.com/cloud" relative to the "TOS" type would indicate
       * which terms of service is being referenced.
       * </pre>
       *
       * <code>string subject = 2;</code>
       *
       * @param value The subject to set.
       * @return This builder for chaining.
       */
      public Builder setSubject(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        subject_ = value;
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The subject, relative to the type, that failed.
       * For example, "google.com/cloud" relative to the "TOS" type would indicate
       * which terms of service is being referenced.
       * </pre>
       *
       * <code>string subject = 2;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearSubject() {
        subject_ = getDefaultInstance().getSubject();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The subject, relative to the type, that failed.
       * For example, "google.com/cloud" relative to the "TOS" type would indicate
       * which terms of service is being referenced.
       * </pre>
       *
       * <code>string subject = 2;</code>
       *
       * @param value The bytes for subject to set.
       * @return This builder for chaining.
       */
      public Builder setSubjectBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        subject_ = value;
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      private java.lang.Object description_ = "";

      /**
       *
       *
       * <pre>
       * A description of how the precondition failed. Developers can use this
       * description to understand how to fix the failure.
       *
       * For example: "Terms of service not accepted".
       * </pre>
       *
       * <code>string description = 3;</code>
       *
       * @return The description.
       */
      public java.lang.String getDescription() {
        java.lang.Object ref = description_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          description_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * A description of how the precondition failed. Developers can use this
       * description to understand how to fix the failure.
       *
       * For example: "Terms of service not accepted".
       * </pre>
       *
       * <code>string description = 3;</code>
       *
       * @return The bytes for description.
       */
      public com.google.protobuf.ByteString getDescriptionBytes() {
        java.lang.Object ref = description_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          description_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * A description of how the precondition failed. Developers can use this
       * description to understand how to fix the failure.
       *
       * For example: "Terms of service not accepted".
       * </pre>
       *
       * <code>string description = 3;</code>
       *
       * @param value The description to set.
       * @return This builder for chaining.
       */
      public Builder setDescription(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        description_ = value;
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * A description of how the precondition failed. Developers can use this
       * description to understand how to fix the failure.
       *
       * For example: "Terms of service not accepted".
       * </pre>
       *
       * <code>string description = 3;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearDescription() {
        description_ = getDefaultInstance().getDescription();
        bitField0_ = (bitField0_ & ~0x00000004);
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * A description of how the precondition failed. Developers can use this
       * description to understand how to fix the failure.
       *
       * For example: "Terms of service not accepted".
       * </pre>
       *
       * <code>string description = 3;</code>
       *
       * @param value The bytes for description to set.
       * @return This builder for chaining.
       */
      public Builder setDescriptionBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        description_ = value;
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:google.rpc.PreconditionFailure.Violation)
    }

    // @@protoc_insertion_point(class_scope:google.rpc.PreconditionFailure.Violation)
    private static final com.google.rpc.PreconditionFailure.Violation DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.rpc.PreconditionFailure.Violation();
    }

    public static com.google.rpc.PreconditionFailure.Violation getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<Violation> PARSER =
        new com.google.protobuf.AbstractParser<Violation>() {
          @java.lang.Override
          public Violation 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());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<Violation> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<Violation> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.rpc.PreconditionFailure.Violation getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public static final int VIOLATIONS_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private java.util.List<com.google.rpc.PreconditionFailure.Violation> violations_;

  /**
   *
   *
   * <pre>
   * Describes all precondition violations.
   * </pre>
   *
   * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.rpc.PreconditionFailure.Violation> getViolationsList() {
    return violations_;
  }

  /**
   *
   *
   * <pre>
   * Describes all precondition violations.
   * </pre>
   *
   * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.rpc.PreconditionFailure.ViolationOrBuilder>
      getViolationsOrBuilderList() {
    return violations_;
  }

  /**
   *
   *
   * <pre>
   * Describes all precondition violations.
   * </pre>
   *
   * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
   */
  @java.lang.Override
  public int getViolationsCount() {
    return violations_.size();
  }

  /**
   *
   *
   * <pre>
   * Describes all precondition violations.
   * </pre>
   *
   * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
   */
  @java.lang.Override
  public com.google.rpc.PreconditionFailure.Violation getViolations(int index) {
    return violations_.get(index);
  }

  /**
   *
   *
   * <pre>
   * Describes all precondition violations.
   * </pre>
   *
   * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
   */
  @java.lang.Override
  public com.google.rpc.PreconditionFailure.ViolationOrBuilder getViolationsOrBuilder(int index) {
    return violations_.get(index);
  }

  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 {
    for (int i = 0; i < violations_.size(); i++) {
      output.writeMessage(1, violations_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    for (int i = 0; i < violations_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, violations_.get(i));
    }
    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.rpc.PreconditionFailure)) {
      return super.equals(obj);
    }
    com.google.rpc.PreconditionFailure other = (com.google.rpc.PreconditionFailure) obj;

    if (!getViolationsList().equals(other.getViolationsList())) 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();
    if (getViolationsCount() > 0) {
      hash = (37 * hash) + VIOLATIONS_FIELD_NUMBER;
      hash = (53 * hash) + getViolationsList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static com.google.rpc.PreconditionFailure parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.rpc.PreconditionFailure parseFrom(com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

  public static com.google.rpc.PreconditionFailure parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.rpc.PreconditionFailure parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.rpc.PreconditionFailure parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.rpc.PreconditionFailure parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.rpc.PreconditionFailure parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.rpc.PreconditionFailure parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.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.rpc.PreconditionFailure 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.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }

  /**
   *
   *
   * <pre>
   * Describes what preconditions have failed.
   *
   * For example, if an RPC failed because it required the Terms of Service to be
   * acknowledged, it could list the terms of service violation in the
   * PreconditionFailure message.
   * </pre>
   *
   * Protobuf type {@code google.rpc.PreconditionFailure}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.rpc.PreconditionFailure)
      com.google.rpc.PreconditionFailureOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.rpc.ErrorDetailsProto
          .internal_static_google_rpc_PreconditionFailure_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.rpc.ErrorDetailsProto
          .internal_static_google_rpc_PreconditionFailure_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.rpc.PreconditionFailure.class,
              com.google.rpc.PreconditionFailure.Builder.class);
    }

    // Construct using com.google.rpc.PreconditionFailure.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      if (violationsBuilder_ == null) {
        violations_ = java.util.Collections.emptyList();
      } else {
        violations_ = null;
        violationsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000001);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.rpc.ErrorDetailsProto
          .internal_static_google_rpc_PreconditionFailure_descriptor;
    }

    @java.lang.Override
    public com.google.rpc.PreconditionFailure getDefaultInstanceForType() {
      return com.google.rpc.PreconditionFailure.getDefaultInstance();
    }

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

    @java.lang.Override
    public com.google.rpc.PreconditionFailure buildPartial() {
      com.google.rpc.PreconditionFailure result = new com.google.rpc.PreconditionFailure(this);
      buildPartialRepeatedFields(result);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartialRepeatedFields(com.google.rpc.PreconditionFailure result) {
      if (violationsBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          violations_ = java.util.Collections.unmodifiableList(violations_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.violations_ = violations_;
      } else {
        result.violations_ = violationsBuilder_.build();
      }
    }

    private void buildPartial0(com.google.rpc.PreconditionFailure result) {
      int from_bitField0_ = bitField0_;
    }

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

    public Builder mergeFrom(com.google.rpc.PreconditionFailure other) {
      if (other == com.google.rpc.PreconditionFailure.getDefaultInstance()) return this;
      if (violationsBuilder_ == null) {
        if (!other.violations_.isEmpty()) {
          if (violations_.isEmpty()) {
            violations_ = other.violations_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureViolationsIsMutable();
            violations_.addAll(other.violations_);
          }
          onChanged();
        }
      } else {
        if (!other.violations_.isEmpty()) {
          if (violationsBuilder_.isEmpty()) {
            violationsBuilder_.dispose();
            violationsBuilder_ = null;
            violations_ = other.violations_;
            bitField0_ = (bitField0_ & ~0x00000001);
            violationsBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                    ? internalGetViolationsFieldBuilder()
                    : null;
          } else {
            violationsBuilder_.addAllMessages(other.violations_);
          }
        }
      }
      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:
              {
                com.google.rpc.PreconditionFailure.Violation m =
                    input.readMessage(
                        com.google.rpc.PreconditionFailure.Violation.parser(), extensionRegistry);
                if (violationsBuilder_ == null) {
                  ensureViolationsIsMutable();
                  violations_.add(m);
                } else {
                  violationsBuilder_.addMessage(m);
                }
                break;
              } // case 10
            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.util.List<com.google.rpc.PreconditionFailure.Violation> violations_ =
        java.util.Collections.emptyList();

    private void ensureViolationsIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        violations_ =
            new java.util.ArrayList<com.google.rpc.PreconditionFailure.Violation>(violations_);
        bitField0_ |= 0x00000001;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.rpc.PreconditionFailure.Violation,
            com.google.rpc.PreconditionFailure.Violation.Builder,
            com.google.rpc.PreconditionFailure.ViolationOrBuilder>
        violationsBuilder_;

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public java.util.List<com.google.rpc.PreconditionFailure.Violation> getViolationsList() {
      if (violationsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(violations_);
      } else {
        return violationsBuilder_.getMessageList();
      }
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public int getViolationsCount() {
      if (violationsBuilder_ == null) {
        return violations_.size();
      } else {
        return violationsBuilder_.getCount();
      }
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public com.google.rpc.PreconditionFailure.Violation getViolations(int index) {
      if (violationsBuilder_ == null) {
        return violations_.get(index);
      } else {
        return violationsBuilder_.getMessage(index);
      }
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public Builder setViolations(int index, com.google.rpc.PreconditionFailure.Violation value) {
      if (violationsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureViolationsIsMutable();
        violations_.set(index, value);
        onChanged();
      } else {
        violationsBuilder_.setMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public Builder setViolations(
        int index, com.google.rpc.PreconditionFailure.Violation.Builder builderForValue) {
      if (violationsBuilder_ == null) {
        ensureViolationsIsMutable();
        violations_.set(index, builderForValue.build());
        onChanged();
      } else {
        violationsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public Builder addViolations(com.google.rpc.PreconditionFailure.Violation value) {
      if (violationsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureViolationsIsMutable();
        violations_.add(value);
        onChanged();
      } else {
        violationsBuilder_.addMessage(value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public Builder addViolations(int index, com.google.rpc.PreconditionFailure.Violation value) {
      if (violationsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureViolationsIsMutable();
        violations_.add(index, value);
        onChanged();
      } else {
        violationsBuilder_.addMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public Builder addViolations(
        com.google.rpc.PreconditionFailure.Violation.Builder builderForValue) {
      if (violationsBuilder_ == null) {
        ensureViolationsIsMutable();
        violations_.add(builderForValue.build());
        onChanged();
      } else {
        violationsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public Builder addViolations(
        int index, com.google.rpc.PreconditionFailure.Violation.Builder builderForValue) {
      if (violationsBuilder_ == null) {
        ensureViolationsIsMutable();
        violations_.add(index, builderForValue.build());
        onChanged();
      } else {
        violationsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public Builder addAllViolations(
        java.lang.Iterable<? extends com.google.rpc.PreconditionFailure.Violation> values) {
      if (violationsBuilder_ == null) {
        ensureViolationsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, violations_);
        onChanged();
      } else {
        violationsBuilder_.addAllMessages(values);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public Builder clearViolations() {
      if (violationsBuilder_ == null) {
        violations_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        violationsBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public Builder removeViolations(int index) {
      if (violationsBuilder_ == null) {
        ensureViolationsIsMutable();
        violations_.remove(index);
        onChanged();
      } else {
        violationsBuilder_.remove(index);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public com.google.rpc.PreconditionFailure.Violation.Builder getViolationsBuilder(int index) {
      return internalGetViolationsFieldBuilder().getBuilder(index);
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public com.google.rpc.PreconditionFailure.ViolationOrBuilder getViolationsOrBuilder(int index) {
      if (violationsBuilder_ == null) {
        return violations_.get(index);
      } else {
        return violationsBuilder_.getMessageOrBuilder(index);
      }
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public java.util.List<? extends com.google.rpc.PreconditionFailure.ViolationOrBuilder>
        getViolationsOrBuilderList() {
      if (violationsBuilder_ != null) {
        return violationsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(violations_);
      }
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public com.google.rpc.PreconditionFailure.Violation.Builder addViolationsBuilder() {
      return internalGetViolationsFieldBuilder()
          .addBuilder(com.google.rpc.PreconditionFailure.Violation.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public com.google.rpc.PreconditionFailure.Violation.Builder addViolationsBuilder(int index) {
      return internalGetViolationsFieldBuilder()
          .addBuilder(index, com.google.rpc.PreconditionFailure.Violation.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * Describes all precondition violations.
     * </pre>
     *
     * <code>repeated .google.rpc.PreconditionFailure.Violation violations = 1;</code>
     */
    public java.util.List<com.google.rpc.PreconditionFailure.Violation.Builder>
        getViolationsBuilderList() {
      return internalGetViolationsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.rpc.PreconditionFailure.Violation,
            com.google.rpc.PreconditionFailure.Violation.Builder,
            com.google.rpc.PreconditionFailure.ViolationOrBuilder>
        internalGetViolationsFieldBuilder() {
      if (violationsBuilder_ == null) {
        violationsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilder<
                com.google.rpc.PreconditionFailure.Violation,
                com.google.rpc.PreconditionFailure.Violation.Builder,
                com.google.rpc.PreconditionFailure.ViolationOrBuilder>(
                violations_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean());
        violations_ = null;
      }
      return violationsBuilder_;
    }

    // @@protoc_insertion_point(builder_scope:google.rpc.PreconditionFailure)
  }

  // @@protoc_insertion_point(class_scope:google.rpc.PreconditionFailure)
  private static final com.google.rpc.PreconditionFailure DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.rpc.PreconditionFailure();
  }

  public static com.google.rpc.PreconditionFailure getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<PreconditionFailure> PARSER =
      new com.google.protobuf.AbstractParser<PreconditionFailure>() {
        @java.lang.Override
        public PreconditionFailure 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());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<PreconditionFailure> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<PreconditionFailure> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.rpc.PreconditionFailure getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
