// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/datastore/v1/datastore.proto

package com.google.datastore.v1;

/**
 *
 *
 * <pre>
 * Options for beginning a new transaction.
 * Transactions can be created explicitly with calls to
 * [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]
 * or implicitly by setting
 * [ReadOptions.new_transaction][google.datastore.v1.ReadOptions.new_transaction]
 * in read requests.
 * </pre>
 *
 * Protobuf type {@code google.datastore.v1.TransactionOptions}
 */
public final class TransactionOptions extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.datastore.v1.TransactionOptions)
    TransactionOptionsOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use TransactionOptions.newBuilder() to construct.
  private TransactionOptions(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private TransactionOptions() {}

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  private TransactionOptions(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10:
            {
              com.google.datastore.v1.TransactionOptions.ReadWrite.Builder subBuilder = null;
              if (modeCase_ == 1) {
                subBuilder =
                    ((com.google.datastore.v1.TransactionOptions.ReadWrite) mode_).toBuilder();
              }
              mode_ =
                  input.readMessage(
                      com.google.datastore.v1.TransactionOptions.ReadWrite.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom((com.google.datastore.v1.TransactionOptions.ReadWrite) mode_);
                mode_ = subBuilder.buildPartial();
              }
              modeCase_ = 1;
              break;
            }
          case 18:
            {
              com.google.datastore.v1.TransactionOptions.ReadOnly.Builder subBuilder = null;
              if (modeCase_ == 2) {
                subBuilder =
                    ((com.google.datastore.v1.TransactionOptions.ReadOnly) mode_).toBuilder();
              }
              mode_ =
                  input.readMessage(
                      com.google.datastore.v1.TransactionOptions.ReadOnly.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom((com.google.datastore.v1.TransactionOptions.ReadOnly) mode_);
                mode_ = subBuilder.buildPartial();
              }
              modeCase_ = 2;
              break;
            }
          default:
            {
              if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.datastore.v1.DatastoreProto
        .internal_static_google_datastore_v1_TransactionOptions_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.datastore.v1.DatastoreProto
        .internal_static_google_datastore_v1_TransactionOptions_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.datastore.v1.TransactionOptions.class,
            com.google.datastore.v1.TransactionOptions.Builder.class);
  }

  public interface ReadWriteOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.datastore.v1.TransactionOptions.ReadWrite)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The transaction identifier of the transaction being retried.
     * </pre>
     *
     * <code>bytes previous_transaction = 1;</code>
     */
    com.google.protobuf.ByteString getPreviousTransaction();
  }
  /**
   *
   *
   * <pre>
   * Options specific to read / write transactions.
   * </pre>
   *
   * Protobuf type {@code google.datastore.v1.TransactionOptions.ReadWrite}
   */
  public static final class ReadWrite extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.datastore.v1.TransactionOptions.ReadWrite)
      ReadWriteOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use ReadWrite.newBuilder() to construct.
    private ReadWrite(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private ReadWrite() {
      previousTransaction_ = com.google.protobuf.ByteString.EMPTY;
    }

    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
      return this.unknownFields;
    }

    private ReadWrite(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      this();
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                previousTransaction_ = input.readBytes();
                break;
              }
            default:
              {
                if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                  done = true;
                }
                break;
              }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.datastore.v1.DatastoreProto
          .internal_static_google_datastore_v1_TransactionOptions_ReadWrite_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.datastore.v1.DatastoreProto
          .internal_static_google_datastore_v1_TransactionOptions_ReadWrite_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.datastore.v1.TransactionOptions.ReadWrite.class,
              com.google.datastore.v1.TransactionOptions.ReadWrite.Builder.class);
    }

    public static final int PREVIOUS_TRANSACTION_FIELD_NUMBER = 1;
    private com.google.protobuf.ByteString previousTransaction_;
    /**
     *
     *
     * <pre>
     * The transaction identifier of the transaction being retried.
     * </pre>
     *
     * <code>bytes previous_transaction = 1;</code>
     */
    public com.google.protobuf.ByteString getPreviousTransaction() {
      return previousTransaction_;
    }

    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 (!previousTransaction_.isEmpty()) {
        output.writeBytes(1, previousTransaction_);
      }
      unknownFields.writeTo(output);
    }

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

      size = 0;
      if (!previousTransaction_.isEmpty()) {
        size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, previousTransaction_);
      }
      size += unknownFields.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.datastore.v1.TransactionOptions.ReadWrite)) {
        return super.equals(obj);
      }
      com.google.datastore.v1.TransactionOptions.ReadWrite other =
          (com.google.datastore.v1.TransactionOptions.ReadWrite) obj;

      if (!getPreviousTransaction().equals(other.getPreviousTransaction())) return false;
      if (!unknownFields.equals(other.unknownFields)) 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) + PREVIOUS_TRANSACTION_FIELD_NUMBER;
      hash = (53 * hash) + getPreviousTransaction().hashCode();
      hash = (29 * hash) + unknownFields.hashCode();
      memoizedHashCode = hash;
      return hash;
    }

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

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

    public static com.google.datastore.v1.TransactionOptions.ReadWrite parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

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

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

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

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

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

    public static com.google.datastore.v1.TransactionOptions.ReadWrite 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.datastore.v1.TransactionOptions.ReadWrite 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>
     * Options specific to read / write transactions.
     * </pre>
     *
     * Protobuf type {@code google.datastore.v1.TransactionOptions.ReadWrite}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.datastore.v1.TransactionOptions.ReadWrite)
        com.google.datastore.v1.TransactionOptions.ReadWriteOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.datastore.v1.DatastoreProto
            .internal_static_google_datastore_v1_TransactionOptions_ReadWrite_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.datastore.v1.DatastoreProto
            .internal_static_google_datastore_v1_TransactionOptions_ReadWrite_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.datastore.v1.TransactionOptions.ReadWrite.class,
                com.google.datastore.v1.TransactionOptions.ReadWrite.Builder.class);
      }

      // Construct using com.google.datastore.v1.TransactionOptions.ReadWrite.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

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

      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        previousTransaction_ = com.google.protobuf.ByteString.EMPTY;

        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.datastore.v1.DatastoreProto
            .internal_static_google_datastore_v1_TransactionOptions_ReadWrite_descriptor;
      }

      @java.lang.Override
      public com.google.datastore.v1.TransactionOptions.ReadWrite getDefaultInstanceForType() {
        return com.google.datastore.v1.TransactionOptions.ReadWrite.getDefaultInstance();
      }

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

      @java.lang.Override
      public com.google.datastore.v1.TransactionOptions.ReadWrite buildPartial() {
        com.google.datastore.v1.TransactionOptions.ReadWrite result =
            new com.google.datastore.v1.TransactionOptions.ReadWrite(this);
        result.previousTransaction_ = previousTransaction_;
        onBuilt();
        return result;
      }

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

      public Builder mergeFrom(com.google.datastore.v1.TransactionOptions.ReadWrite other) {
        if (other == com.google.datastore.v1.TransactionOptions.ReadWrite.getDefaultInstance())
          return this;
        if (other.getPreviousTransaction() != com.google.protobuf.ByteString.EMPTY) {
          setPreviousTransaction(other.getPreviousTransaction());
        }
        this.mergeUnknownFields(other.unknownFields);
        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 {
        com.google.datastore.v1.TransactionOptions.ReadWrite parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage =
              (com.google.datastore.v1.TransactionOptions.ReadWrite) e.getUnfinishedMessage();
          throw e.unwrapIOException();
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }

      private com.google.protobuf.ByteString previousTransaction_ =
          com.google.protobuf.ByteString.EMPTY;
      /**
       *
       *
       * <pre>
       * The transaction identifier of the transaction being retried.
       * </pre>
       *
       * <code>bytes previous_transaction = 1;</code>
       */
      public com.google.protobuf.ByteString getPreviousTransaction() {
        return previousTransaction_;
      }
      /**
       *
       *
       * <pre>
       * The transaction identifier of the transaction being retried.
       * </pre>
       *
       * <code>bytes previous_transaction = 1;</code>
       */
      public Builder setPreviousTransaction(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }

        previousTransaction_ = value;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The transaction identifier of the transaction being retried.
       * </pre>
       *
       * <code>bytes previous_transaction = 1;</code>
       */
      public Builder clearPreviousTransaction() {

        previousTransaction_ = getDefaultInstance().getPreviousTransaction();
        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.datastore.v1.TransactionOptions.ReadWrite)
    }

    // @@protoc_insertion_point(class_scope:google.datastore.v1.TransactionOptions.ReadWrite)
    private static final com.google.datastore.v1.TransactionOptions.ReadWrite DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.datastore.v1.TransactionOptions.ReadWrite();
    }

    public static com.google.datastore.v1.TransactionOptions.ReadWrite getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<ReadWrite> PARSER =
        new com.google.protobuf.AbstractParser<ReadWrite>() {
          @java.lang.Override
          public ReadWrite parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            return new ReadWrite(input, extensionRegistry);
          }
        };

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

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

    @java.lang.Override
    public com.google.datastore.v1.TransactionOptions.ReadWrite getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface ReadOnlyOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.datastore.v1.TransactionOptions.ReadOnly)
      com.google.protobuf.MessageOrBuilder {}
  /**
   *
   *
   * <pre>
   * Options specific to read-only transactions.
   * </pre>
   *
   * Protobuf type {@code google.datastore.v1.TransactionOptions.ReadOnly}
   */
  public static final class ReadOnly extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.datastore.v1.TransactionOptions.ReadOnly)
      ReadOnlyOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use ReadOnly.newBuilder() to construct.
    private ReadOnly(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private ReadOnly() {}

    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
      return this.unknownFields;
    }

    private ReadOnly(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      this();
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default:
              {
                if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                  done = true;
                }
                break;
              }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.datastore.v1.DatastoreProto
          .internal_static_google_datastore_v1_TransactionOptions_ReadOnly_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.datastore.v1.DatastoreProto
          .internal_static_google_datastore_v1_TransactionOptions_ReadOnly_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.datastore.v1.TransactionOptions.ReadOnly.class,
              com.google.datastore.v1.TransactionOptions.ReadOnly.Builder.class);
    }

    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 {
      unknownFields.writeTo(output);
    }

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

      size = 0;
      size += unknownFields.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.datastore.v1.TransactionOptions.ReadOnly)) {
        return super.equals(obj);
      }
      com.google.datastore.v1.TransactionOptions.ReadOnly other =
          (com.google.datastore.v1.TransactionOptions.ReadOnly) obj;

      if (!unknownFields.equals(other.unknownFields)) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (29 * hash) + unknownFields.hashCode();
      memoizedHashCode = hash;
      return hash;
    }

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

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

    public static com.google.datastore.v1.TransactionOptions.ReadOnly parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

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

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

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

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

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

    public static com.google.datastore.v1.TransactionOptions.ReadOnly 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.datastore.v1.TransactionOptions.ReadOnly 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>
     * Options specific to read-only transactions.
     * </pre>
     *
     * Protobuf type {@code google.datastore.v1.TransactionOptions.ReadOnly}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.datastore.v1.TransactionOptions.ReadOnly)
        com.google.datastore.v1.TransactionOptions.ReadOnlyOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.datastore.v1.DatastoreProto
            .internal_static_google_datastore_v1_TransactionOptions_ReadOnly_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.datastore.v1.DatastoreProto
            .internal_static_google_datastore_v1_TransactionOptions_ReadOnly_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.datastore.v1.TransactionOptions.ReadOnly.class,
                com.google.datastore.v1.TransactionOptions.ReadOnly.Builder.class);
      }

      // Construct using com.google.datastore.v1.TransactionOptions.ReadOnly.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

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

      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
      }

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

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.datastore.v1.DatastoreProto
            .internal_static_google_datastore_v1_TransactionOptions_ReadOnly_descriptor;
      }

      @java.lang.Override
      public com.google.datastore.v1.TransactionOptions.ReadOnly getDefaultInstanceForType() {
        return com.google.datastore.v1.TransactionOptions.ReadOnly.getDefaultInstance();
      }

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

      @java.lang.Override
      public com.google.datastore.v1.TransactionOptions.ReadOnly buildPartial() {
        com.google.datastore.v1.TransactionOptions.ReadOnly result =
            new com.google.datastore.v1.TransactionOptions.ReadOnly(this);
        onBuilt();
        return result;
      }

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

      public Builder mergeFrom(com.google.datastore.v1.TransactionOptions.ReadOnly other) {
        if (other == com.google.datastore.v1.TransactionOptions.ReadOnly.getDefaultInstance())
          return this;
        this.mergeUnknownFields(other.unknownFields);
        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 {
        com.google.datastore.v1.TransactionOptions.ReadOnly parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage =
              (com.google.datastore.v1.TransactionOptions.ReadOnly) e.getUnfinishedMessage();
          throw e.unwrapIOException();
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        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.datastore.v1.TransactionOptions.ReadOnly)
    }

    // @@protoc_insertion_point(class_scope:google.datastore.v1.TransactionOptions.ReadOnly)
    private static final com.google.datastore.v1.TransactionOptions.ReadOnly DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.datastore.v1.TransactionOptions.ReadOnly();
    }

    public static com.google.datastore.v1.TransactionOptions.ReadOnly getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<ReadOnly> PARSER =
        new com.google.protobuf.AbstractParser<ReadOnly>() {
          @java.lang.Override
          public ReadOnly parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            return new ReadOnly(input, extensionRegistry);
          }
        };

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

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

    @java.lang.Override
    public com.google.datastore.v1.TransactionOptions.ReadOnly getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  private int modeCase_ = 0;
  private java.lang.Object mode_;

  public enum ModeCase implements com.google.protobuf.Internal.EnumLite {
    READ_WRITE(1),
    READ_ONLY(2),
    MODE_NOT_SET(0);
    private final int value;

    private ModeCase(int value) {
      this.value = value;
    }
    /** @deprecated Use {@link #forNumber(int)} instead. */
    @java.lang.Deprecated
    public static ModeCase valueOf(int value) {
      return forNumber(value);
    }

    public static ModeCase forNumber(int value) {
      switch (value) {
        case 1:
          return READ_WRITE;
        case 2:
          return READ_ONLY;
        case 0:
          return MODE_NOT_SET;
        default:
          return null;
      }
    }

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

  public ModeCase getModeCase() {
    return ModeCase.forNumber(modeCase_);
  }

  public static final int READ_WRITE_FIELD_NUMBER = 1;
  /**
   *
   *
   * <pre>
   * The transaction should allow both reads and writes.
   * </pre>
   *
   * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
   */
  public boolean hasReadWrite() {
    return modeCase_ == 1;
  }
  /**
   *
   *
   * <pre>
   * The transaction should allow both reads and writes.
   * </pre>
   *
   * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
   */
  public com.google.datastore.v1.TransactionOptions.ReadWrite getReadWrite() {
    if (modeCase_ == 1) {
      return (com.google.datastore.v1.TransactionOptions.ReadWrite) mode_;
    }
    return com.google.datastore.v1.TransactionOptions.ReadWrite.getDefaultInstance();
  }
  /**
   *
   *
   * <pre>
   * The transaction should allow both reads and writes.
   * </pre>
   *
   * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
   */
  public com.google.datastore.v1.TransactionOptions.ReadWriteOrBuilder getReadWriteOrBuilder() {
    if (modeCase_ == 1) {
      return (com.google.datastore.v1.TransactionOptions.ReadWrite) mode_;
    }
    return com.google.datastore.v1.TransactionOptions.ReadWrite.getDefaultInstance();
  }

  public static final int READ_ONLY_FIELD_NUMBER = 2;
  /**
   *
   *
   * <pre>
   * The transaction should only allow reads.
   * </pre>
   *
   * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
   */
  public boolean hasReadOnly() {
    return modeCase_ == 2;
  }
  /**
   *
   *
   * <pre>
   * The transaction should only allow reads.
   * </pre>
   *
   * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
   */
  public com.google.datastore.v1.TransactionOptions.ReadOnly getReadOnly() {
    if (modeCase_ == 2) {
      return (com.google.datastore.v1.TransactionOptions.ReadOnly) mode_;
    }
    return com.google.datastore.v1.TransactionOptions.ReadOnly.getDefaultInstance();
  }
  /**
   *
   *
   * <pre>
   * The transaction should only allow reads.
   * </pre>
   *
   * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
   */
  public com.google.datastore.v1.TransactionOptions.ReadOnlyOrBuilder getReadOnlyOrBuilder() {
    if (modeCase_ == 2) {
      return (com.google.datastore.v1.TransactionOptions.ReadOnly) mode_;
    }
    return com.google.datastore.v1.TransactionOptions.ReadOnly.getDefaultInstance();
  }

  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 (modeCase_ == 1) {
      output.writeMessage(1, (com.google.datastore.v1.TransactionOptions.ReadWrite) mode_);
    }
    if (modeCase_ == 2) {
      output.writeMessage(2, (com.google.datastore.v1.TransactionOptions.ReadOnly) mode_);
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (modeCase_ == 1) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              1, (com.google.datastore.v1.TransactionOptions.ReadWrite) mode_);
    }
    if (modeCase_ == 2) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              2, (com.google.datastore.v1.TransactionOptions.ReadOnly) mode_);
    }
    size += unknownFields.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.datastore.v1.TransactionOptions)) {
      return super.equals(obj);
    }
    com.google.datastore.v1.TransactionOptions other =
        (com.google.datastore.v1.TransactionOptions) obj;

    if (!getModeCase().equals(other.getModeCase())) return false;
    switch (modeCase_) {
      case 1:
        if (!getReadWrite().equals(other.getReadWrite())) return false;
        break;
      case 2:
        if (!getReadOnly().equals(other.getReadOnly())) return false;
        break;
      case 0:
      default:
    }
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    switch (modeCase_) {
      case 1:
        hash = (37 * hash) + READ_WRITE_FIELD_NUMBER;
        hash = (53 * hash) + getReadWrite().hashCode();
        break;
      case 2:
        hash = (37 * hash) + READ_ONLY_FIELD_NUMBER;
        hash = (53 * hash) + getReadOnly().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

  public static com.google.datastore.v1.TransactionOptions parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

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

  public static com.google.datastore.v1.TransactionOptions 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.datastore.v1.TransactionOptions 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>
   * Options for beginning a new transaction.
   * Transactions can be created explicitly with calls to
   * [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]
   * or implicitly by setting
   * [ReadOptions.new_transaction][google.datastore.v1.ReadOptions.new_transaction]
   * in read requests.
   * </pre>
   *
   * Protobuf type {@code google.datastore.v1.TransactionOptions}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.datastore.v1.TransactionOptions)
      com.google.datastore.v1.TransactionOptionsOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.datastore.v1.DatastoreProto
          .internal_static_google_datastore_v1_TransactionOptions_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.datastore.v1.DatastoreProto
          .internal_static_google_datastore_v1_TransactionOptions_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.datastore.v1.TransactionOptions.class,
              com.google.datastore.v1.TransactionOptions.Builder.class);
    }

    // Construct using com.google.datastore.v1.TransactionOptions.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      modeCase_ = 0;
      mode_ = null;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.datastore.v1.DatastoreProto
          .internal_static_google_datastore_v1_TransactionOptions_descriptor;
    }

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

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

    @java.lang.Override
    public com.google.datastore.v1.TransactionOptions buildPartial() {
      com.google.datastore.v1.TransactionOptions result =
          new com.google.datastore.v1.TransactionOptions(this);
      if (modeCase_ == 1) {
        if (readWriteBuilder_ == null) {
          result.mode_ = mode_;
        } else {
          result.mode_ = readWriteBuilder_.build();
        }
      }
      if (modeCase_ == 2) {
        if (readOnlyBuilder_ == null) {
          result.mode_ = mode_;
        } else {
          result.mode_ = readOnlyBuilder_.build();
        }
      }
      result.modeCase_ = modeCase_;
      onBuilt();
      return result;
    }

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

    public Builder mergeFrom(com.google.datastore.v1.TransactionOptions other) {
      if (other == com.google.datastore.v1.TransactionOptions.getDefaultInstance()) return this;
      switch (other.getModeCase()) {
        case READ_WRITE:
          {
            mergeReadWrite(other.getReadWrite());
            break;
          }
        case READ_ONLY:
          {
            mergeReadOnly(other.getReadOnly());
            break;
          }
        case MODE_NOT_SET:
          {
            break;
          }
      }
      this.mergeUnknownFields(other.unknownFields);
      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 {
      com.google.datastore.v1.TransactionOptions parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.datastore.v1.TransactionOptions) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int modeCase_ = 0;
    private java.lang.Object mode_;

    public ModeCase getModeCase() {
      return ModeCase.forNumber(modeCase_);
    }

    public Builder clearMode() {
      modeCase_ = 0;
      mode_ = null;
      onChanged();
      return this;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.datastore.v1.TransactionOptions.ReadWrite,
            com.google.datastore.v1.TransactionOptions.ReadWrite.Builder,
            com.google.datastore.v1.TransactionOptions.ReadWriteOrBuilder>
        readWriteBuilder_;
    /**
     *
     *
     * <pre>
     * The transaction should allow both reads and writes.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
     */
    public boolean hasReadWrite() {
      return modeCase_ == 1;
    }
    /**
     *
     *
     * <pre>
     * The transaction should allow both reads and writes.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
     */
    public com.google.datastore.v1.TransactionOptions.ReadWrite getReadWrite() {
      if (readWriteBuilder_ == null) {
        if (modeCase_ == 1) {
          return (com.google.datastore.v1.TransactionOptions.ReadWrite) mode_;
        }
        return com.google.datastore.v1.TransactionOptions.ReadWrite.getDefaultInstance();
      } else {
        if (modeCase_ == 1) {
          return readWriteBuilder_.getMessage();
        }
        return com.google.datastore.v1.TransactionOptions.ReadWrite.getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * The transaction should allow both reads and writes.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
     */
    public Builder setReadWrite(com.google.datastore.v1.TransactionOptions.ReadWrite value) {
      if (readWriteBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        mode_ = value;
        onChanged();
      } else {
        readWriteBuilder_.setMessage(value);
      }
      modeCase_ = 1;
      return this;
    }
    /**
     *
     *
     * <pre>
     * The transaction should allow both reads and writes.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
     */
    public Builder setReadWrite(
        com.google.datastore.v1.TransactionOptions.ReadWrite.Builder builderForValue) {
      if (readWriteBuilder_ == null) {
        mode_ = builderForValue.build();
        onChanged();
      } else {
        readWriteBuilder_.setMessage(builderForValue.build());
      }
      modeCase_ = 1;
      return this;
    }
    /**
     *
     *
     * <pre>
     * The transaction should allow both reads and writes.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
     */
    public Builder mergeReadWrite(com.google.datastore.v1.TransactionOptions.ReadWrite value) {
      if (readWriteBuilder_ == null) {
        if (modeCase_ == 1
            && mode_ != com.google.datastore.v1.TransactionOptions.ReadWrite.getDefaultInstance()) {
          mode_ =
              com.google.datastore.v1.TransactionOptions.ReadWrite.newBuilder(
                      (com.google.datastore.v1.TransactionOptions.ReadWrite) mode_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          mode_ = value;
        }
        onChanged();
      } else {
        if (modeCase_ == 1) {
          readWriteBuilder_.mergeFrom(value);
        }
        readWriteBuilder_.setMessage(value);
      }
      modeCase_ = 1;
      return this;
    }
    /**
     *
     *
     * <pre>
     * The transaction should allow both reads and writes.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
     */
    public Builder clearReadWrite() {
      if (readWriteBuilder_ == null) {
        if (modeCase_ == 1) {
          modeCase_ = 0;
          mode_ = null;
          onChanged();
        }
      } else {
        if (modeCase_ == 1) {
          modeCase_ = 0;
          mode_ = null;
        }
        readWriteBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The transaction should allow both reads and writes.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
     */
    public com.google.datastore.v1.TransactionOptions.ReadWrite.Builder getReadWriteBuilder() {
      return getReadWriteFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The transaction should allow both reads and writes.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
     */
    public com.google.datastore.v1.TransactionOptions.ReadWriteOrBuilder getReadWriteOrBuilder() {
      if ((modeCase_ == 1) && (readWriteBuilder_ != null)) {
        return readWriteBuilder_.getMessageOrBuilder();
      } else {
        if (modeCase_ == 1) {
          return (com.google.datastore.v1.TransactionOptions.ReadWrite) mode_;
        }
        return com.google.datastore.v1.TransactionOptions.ReadWrite.getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * The transaction should allow both reads and writes.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.datastore.v1.TransactionOptions.ReadWrite,
            com.google.datastore.v1.TransactionOptions.ReadWrite.Builder,
            com.google.datastore.v1.TransactionOptions.ReadWriteOrBuilder>
        getReadWriteFieldBuilder() {
      if (readWriteBuilder_ == null) {
        if (!(modeCase_ == 1)) {
          mode_ = com.google.datastore.v1.TransactionOptions.ReadWrite.getDefaultInstance();
        }
        readWriteBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.datastore.v1.TransactionOptions.ReadWrite,
                com.google.datastore.v1.TransactionOptions.ReadWrite.Builder,
                com.google.datastore.v1.TransactionOptions.ReadWriteOrBuilder>(
                (com.google.datastore.v1.TransactionOptions.ReadWrite) mode_,
                getParentForChildren(),
                isClean());
        mode_ = null;
      }
      modeCase_ = 1;
      onChanged();
      ;
      return readWriteBuilder_;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.datastore.v1.TransactionOptions.ReadOnly,
            com.google.datastore.v1.TransactionOptions.ReadOnly.Builder,
            com.google.datastore.v1.TransactionOptions.ReadOnlyOrBuilder>
        readOnlyBuilder_;
    /**
     *
     *
     * <pre>
     * The transaction should only allow reads.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
     */
    public boolean hasReadOnly() {
      return modeCase_ == 2;
    }
    /**
     *
     *
     * <pre>
     * The transaction should only allow reads.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
     */
    public com.google.datastore.v1.TransactionOptions.ReadOnly getReadOnly() {
      if (readOnlyBuilder_ == null) {
        if (modeCase_ == 2) {
          return (com.google.datastore.v1.TransactionOptions.ReadOnly) mode_;
        }
        return com.google.datastore.v1.TransactionOptions.ReadOnly.getDefaultInstance();
      } else {
        if (modeCase_ == 2) {
          return readOnlyBuilder_.getMessage();
        }
        return com.google.datastore.v1.TransactionOptions.ReadOnly.getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * The transaction should only allow reads.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
     */
    public Builder setReadOnly(com.google.datastore.v1.TransactionOptions.ReadOnly value) {
      if (readOnlyBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        mode_ = value;
        onChanged();
      } else {
        readOnlyBuilder_.setMessage(value);
      }
      modeCase_ = 2;
      return this;
    }
    /**
     *
     *
     * <pre>
     * The transaction should only allow reads.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
     */
    public Builder setReadOnly(
        com.google.datastore.v1.TransactionOptions.ReadOnly.Builder builderForValue) {
      if (readOnlyBuilder_ == null) {
        mode_ = builderForValue.build();
        onChanged();
      } else {
        readOnlyBuilder_.setMessage(builderForValue.build());
      }
      modeCase_ = 2;
      return this;
    }
    /**
     *
     *
     * <pre>
     * The transaction should only allow reads.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
     */
    public Builder mergeReadOnly(com.google.datastore.v1.TransactionOptions.ReadOnly value) {
      if (readOnlyBuilder_ == null) {
        if (modeCase_ == 2
            && mode_ != com.google.datastore.v1.TransactionOptions.ReadOnly.getDefaultInstance()) {
          mode_ =
              com.google.datastore.v1.TransactionOptions.ReadOnly.newBuilder(
                      (com.google.datastore.v1.TransactionOptions.ReadOnly) mode_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          mode_ = value;
        }
        onChanged();
      } else {
        if (modeCase_ == 2) {
          readOnlyBuilder_.mergeFrom(value);
        }
        readOnlyBuilder_.setMessage(value);
      }
      modeCase_ = 2;
      return this;
    }
    /**
     *
     *
     * <pre>
     * The transaction should only allow reads.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
     */
    public Builder clearReadOnly() {
      if (readOnlyBuilder_ == null) {
        if (modeCase_ == 2) {
          modeCase_ = 0;
          mode_ = null;
          onChanged();
        }
      } else {
        if (modeCase_ == 2) {
          modeCase_ = 0;
          mode_ = null;
        }
        readOnlyBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The transaction should only allow reads.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
     */
    public com.google.datastore.v1.TransactionOptions.ReadOnly.Builder getReadOnlyBuilder() {
      return getReadOnlyFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The transaction should only allow reads.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
     */
    public com.google.datastore.v1.TransactionOptions.ReadOnlyOrBuilder getReadOnlyOrBuilder() {
      if ((modeCase_ == 2) && (readOnlyBuilder_ != null)) {
        return readOnlyBuilder_.getMessageOrBuilder();
      } else {
        if (modeCase_ == 2) {
          return (com.google.datastore.v1.TransactionOptions.ReadOnly) mode_;
        }
        return com.google.datastore.v1.TransactionOptions.ReadOnly.getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * The transaction should only allow reads.
     * </pre>
     *
     * <code>.google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.datastore.v1.TransactionOptions.ReadOnly,
            com.google.datastore.v1.TransactionOptions.ReadOnly.Builder,
            com.google.datastore.v1.TransactionOptions.ReadOnlyOrBuilder>
        getReadOnlyFieldBuilder() {
      if (readOnlyBuilder_ == null) {
        if (!(modeCase_ == 2)) {
          mode_ = com.google.datastore.v1.TransactionOptions.ReadOnly.getDefaultInstance();
        }
        readOnlyBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.datastore.v1.TransactionOptions.ReadOnly,
                com.google.datastore.v1.TransactionOptions.ReadOnly.Builder,
                com.google.datastore.v1.TransactionOptions.ReadOnlyOrBuilder>(
                (com.google.datastore.v1.TransactionOptions.ReadOnly) mode_,
                getParentForChildren(),
                isClean());
        mode_ = null;
      }
      modeCase_ = 2;
      onChanged();
      ;
      return readOnlyBuilder_;
    }

    @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.datastore.v1.TransactionOptions)
  }

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

  static {
    DEFAULT_INSTANCE = new com.google.datastore.v1.TransactionOptions();
  }

  public static com.google.datastore.v1.TransactionOptions getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<TransactionOptions> PARSER =
      new com.google.protobuf.AbstractParser<TransactionOptions>() {
        @java.lang.Override
        public TransactionOptions parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          return new TransactionOptions(input, extensionRegistry);
        }
      };

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

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

  @java.lang.Override
  public com.google.datastore.v1.TransactionOptions getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
