/*
 * 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/storage/v2/storage.proto
// Protobuf Java Version: 4.33.2

package com.google.storage.v2;

/**
 *
 *
 * <pre>
 * Describes an attempt to append to an object, possibly over multiple requests.
 * </pre>
 *
 * Protobuf type {@code google.storage.v2.AppendObjectSpec}
 */
@com.google.protobuf.Generated
public final class AppendObjectSpec extends com.google.protobuf.GeneratedMessage
    implements
    // @@protoc_insertion_point(message_implements:google.storage.v2.AppendObjectSpec)
    AppendObjectSpecOrBuilder {
  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= */ "",
        "AppendObjectSpec");
  }

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

  private AppendObjectSpec() {
    bucket_ = "";
    object_ = "";
    routingToken_ = "";
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.storage.v2.StorageProto
        .internal_static_google_storage_v2_AppendObjectSpec_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.storage.v2.StorageProto
        .internal_static_google_storage_v2_AppendObjectSpec_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.storage.v2.AppendObjectSpec.class,
            com.google.storage.v2.AppendObjectSpec.Builder.class);
  }

  private int bitField0_;
  public static final int BUCKET_FIELD_NUMBER = 1;

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

  /**
   *
   *
   * <pre>
   * Required. The name of the bucket containing the object to write.
   * </pre>
   *
   * <code>
   * string bucket = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   * </code>
   *
   * @return The bucket.
   */
  @java.lang.Override
  public java.lang.String getBucket() {
    java.lang.Object ref = bucket_;
    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();
      bucket_ = s;
      return s;
    }
  }

  /**
   *
   *
   * <pre>
   * Required. The name of the bucket containing the object to write.
   * </pre>
   *
   * <code>
   * string bucket = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   * </code>
   *
   * @return The bytes for bucket.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getBucketBytes() {
    java.lang.Object ref = bucket_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      bucket_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int OBJECT_FIELD_NUMBER = 2;

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

  /**
   *
   *
   * <pre>
   * Required. The name of the object to open for writing.
   * </pre>
   *
   * <code>string object = 2 [(.google.api.field_behavior) = REQUIRED];</code>
   *
   * @return The object.
   */
  @java.lang.Override
  public java.lang.String getObject() {
    java.lang.Object ref = object_;
    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();
      object_ = s;
      return s;
    }
  }

  /**
   *
   *
   * <pre>
   * Required. The name of the object to open for writing.
   * </pre>
   *
   * <code>string object = 2 [(.google.api.field_behavior) = REQUIRED];</code>
   *
   * @return The bytes for object.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getObjectBytes() {
    java.lang.Object ref = object_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      object_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int GENERATION_FIELD_NUMBER = 3;
  private long generation_ = 0L;

  /**
   *
   *
   * <pre>
   * Required. The generation number of the object to open for writing.
   * </pre>
   *
   * <code>int64 generation = 3 [(.google.api.field_behavior) = REQUIRED];</code>
   *
   * @return The generation.
   */
  @java.lang.Override
  public long getGeneration() {
    return generation_;
  }

  public static final int IF_METAGENERATION_MATCH_FIELD_NUMBER = 4;
  private long ifMetagenerationMatch_ = 0L;

  /**
   *
   *
   * <pre>
   * Makes the operation conditional on whether the object's current
   * metageneration matches the given value.
   *
   * Note that metageneration preconditions are only checked if `write_handle`
   * is empty.
   * </pre>
   *
   * <code>optional int64 if_metageneration_match = 4;</code>
   *
   * @return Whether the ifMetagenerationMatch field is set.
   */
  @java.lang.Override
  public boolean hasIfMetagenerationMatch() {
    return ((bitField0_ & 0x00000001) != 0);
  }

  /**
   *
   *
   * <pre>
   * Makes the operation conditional on whether the object's current
   * metageneration matches the given value.
   *
   * Note that metageneration preconditions are only checked if `write_handle`
   * is empty.
   * </pre>
   *
   * <code>optional int64 if_metageneration_match = 4;</code>
   *
   * @return The ifMetagenerationMatch.
   */
  @java.lang.Override
  public long getIfMetagenerationMatch() {
    return ifMetagenerationMatch_;
  }

  public static final int IF_METAGENERATION_NOT_MATCH_FIELD_NUMBER = 5;
  private long ifMetagenerationNotMatch_ = 0L;

  /**
   *
   *
   * <pre>
   * Makes the operation conditional on whether the object's current
   * metageneration does not match the given value.
   *
   * Note that metageneration preconditions are only checked if `write_handle`
   * is empty.
   * </pre>
   *
   * <code>optional int64 if_metageneration_not_match = 5;</code>
   *
   * @return Whether the ifMetagenerationNotMatch field is set.
   */
  @java.lang.Override
  public boolean hasIfMetagenerationNotMatch() {
    return ((bitField0_ & 0x00000002) != 0);
  }

  /**
   *
   *
   * <pre>
   * Makes the operation conditional on whether the object's current
   * metageneration does not match the given value.
   *
   * Note that metageneration preconditions are only checked if `write_handle`
   * is empty.
   * </pre>
   *
   * <code>optional int64 if_metageneration_not_match = 5;</code>
   *
   * @return The ifMetagenerationNotMatch.
   */
  @java.lang.Override
  public long getIfMetagenerationNotMatch() {
    return ifMetagenerationNotMatch_;
  }

  public static final int ROUTING_TOKEN_FIELD_NUMBER = 6;

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

  /**
   *
   *
   * <pre>
   * An optional routing token that influences request routing for the stream.
   * Must be provided if a `BidiWriteObjectRedirectedError` is returned.
   * </pre>
   *
   * <code>optional string routing_token = 6;</code>
   *
   * @return Whether the routingToken field is set.
   */
  @java.lang.Override
  public boolean hasRoutingToken() {
    return ((bitField0_ & 0x00000004) != 0);
  }

  /**
   *
   *
   * <pre>
   * An optional routing token that influences request routing for the stream.
   * Must be provided if a `BidiWriteObjectRedirectedError` is returned.
   * </pre>
   *
   * <code>optional string routing_token = 6;</code>
   *
   * @return The routingToken.
   */
  @java.lang.Override
  public java.lang.String getRoutingToken() {
    java.lang.Object ref = routingToken_;
    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();
      routingToken_ = s;
      return s;
    }
  }

  /**
   *
   *
   * <pre>
   * An optional routing token that influences request routing for the stream.
   * Must be provided if a `BidiWriteObjectRedirectedError` is returned.
   * </pre>
   *
   * <code>optional string routing_token = 6;</code>
   *
   * @return The bytes for routingToken.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getRoutingTokenBytes() {
    java.lang.Object ref = routingToken_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      routingToken_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int WRITE_HANDLE_FIELD_NUMBER = 7;
  private com.google.storage.v2.BidiWriteHandle writeHandle_;

  /**
   *
   *
   * <pre>
   * An optional write handle returned from a previous BidiWriteObjectResponse
   * message or a BidiWriteObjectRedirectedError error.
   *
   * Note that metageneration preconditions are only checked if `write_handle`
   * is empty.
   * </pre>
   *
   * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
   *
   * @return Whether the writeHandle field is set.
   */
  @java.lang.Override
  public boolean hasWriteHandle() {
    return ((bitField0_ & 0x00000008) != 0);
  }

  /**
   *
   *
   * <pre>
   * An optional write handle returned from a previous BidiWriteObjectResponse
   * message or a BidiWriteObjectRedirectedError error.
   *
   * Note that metageneration preconditions are only checked if `write_handle`
   * is empty.
   * </pre>
   *
   * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
   *
   * @return The writeHandle.
   */
  @java.lang.Override
  public com.google.storage.v2.BidiWriteHandle getWriteHandle() {
    return writeHandle_ == null
        ? com.google.storage.v2.BidiWriteHandle.getDefaultInstance()
        : writeHandle_;
  }

  /**
   *
   *
   * <pre>
   * An optional write handle returned from a previous BidiWriteObjectResponse
   * message or a BidiWriteObjectRedirectedError error.
   *
   * Note that metageneration preconditions are only checked if `write_handle`
   * is empty.
   * </pre>
   *
   * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
   */
  @java.lang.Override
  public com.google.storage.v2.BidiWriteHandleOrBuilder getWriteHandleOrBuilder() {
    return writeHandle_ == null
        ? com.google.storage.v2.BidiWriteHandle.getDefaultInstance()
        : writeHandle_;
  }

  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(bucket_)) {
      com.google.protobuf.GeneratedMessage.writeString(output, 1, bucket_);
    }
    if (!com.google.protobuf.GeneratedMessage.isStringEmpty(object_)) {
      com.google.protobuf.GeneratedMessage.writeString(output, 2, object_);
    }
    if (generation_ != 0L) {
      output.writeInt64(3, generation_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeInt64(4, ifMetagenerationMatch_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      output.writeInt64(5, ifMetagenerationNotMatch_);
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      com.google.protobuf.GeneratedMessage.writeString(output, 6, routingToken_);
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      output.writeMessage(7, getWriteHandle());
    }
    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(bucket_)) {
      size += com.google.protobuf.GeneratedMessage.computeStringSize(1, bucket_);
    }
    if (!com.google.protobuf.GeneratedMessage.isStringEmpty(object_)) {
      size += com.google.protobuf.GeneratedMessage.computeStringSize(2, object_);
    }
    if (generation_ != 0L) {
      size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, generation_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, ifMetagenerationMatch_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeInt64Size(5, ifMetagenerationNotMatch_);
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      size += com.google.protobuf.GeneratedMessage.computeStringSize(6, routingToken_);
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getWriteHandle());
    }
    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.storage.v2.AppendObjectSpec)) {
      return super.equals(obj);
    }
    com.google.storage.v2.AppendObjectSpec other = (com.google.storage.v2.AppendObjectSpec) obj;

    if (!getBucket().equals(other.getBucket())) return false;
    if (!getObject().equals(other.getObject())) return false;
    if (getGeneration() != other.getGeneration()) return false;
    if (hasIfMetagenerationMatch() != other.hasIfMetagenerationMatch()) return false;
    if (hasIfMetagenerationMatch()) {
      if (getIfMetagenerationMatch() != other.getIfMetagenerationMatch()) return false;
    }
    if (hasIfMetagenerationNotMatch() != other.hasIfMetagenerationNotMatch()) return false;
    if (hasIfMetagenerationNotMatch()) {
      if (getIfMetagenerationNotMatch() != other.getIfMetagenerationNotMatch()) return false;
    }
    if (hasRoutingToken() != other.hasRoutingToken()) return false;
    if (hasRoutingToken()) {
      if (!getRoutingToken().equals(other.getRoutingToken())) return false;
    }
    if (hasWriteHandle() != other.hasWriteHandle()) return false;
    if (hasWriteHandle()) {
      if (!getWriteHandle().equals(other.getWriteHandle())) 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) + BUCKET_FIELD_NUMBER;
    hash = (53 * hash) + getBucket().hashCode();
    hash = (37 * hash) + OBJECT_FIELD_NUMBER;
    hash = (53 * hash) + getObject().hashCode();
    hash = (37 * hash) + GENERATION_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getGeneration());
    if (hasIfMetagenerationMatch()) {
      hash = (37 * hash) + IF_METAGENERATION_MATCH_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getIfMetagenerationMatch());
    }
    if (hasIfMetagenerationNotMatch()) {
      hash = (37 * hash) + IF_METAGENERATION_NOT_MATCH_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getIfMetagenerationNotMatch());
    }
    if (hasRoutingToken()) {
      hash = (37 * hash) + ROUTING_TOKEN_FIELD_NUMBER;
      hash = (53 * hash) + getRoutingToken().hashCode();
    }
    if (hasWriteHandle()) {
      hash = (37 * hash) + WRITE_HANDLE_FIELD_NUMBER;
      hash = (53 * hash) + getWriteHandle().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

  public static com.google.storage.v2.AppendObjectSpec parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

  public static com.google.storage.v2.AppendObjectSpec 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.storage.v2.AppendObjectSpec parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.storage.v2.AppendObjectSpec 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.storage.v2.AppendObjectSpec parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.storage.v2.AppendObjectSpec 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.storage.v2.AppendObjectSpec 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 an attempt to append to an object, possibly over multiple requests.
   * </pre>
   *
   * Protobuf type {@code google.storage.v2.AppendObjectSpec}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.storage.v2.AppendObjectSpec)
      com.google.storage.v2.AppendObjectSpecOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.storage.v2.StorageProto
          .internal_static_google_storage_v2_AppendObjectSpec_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.storage.v2.StorageProto
          .internal_static_google_storage_v2_AppendObjectSpec_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.storage.v2.AppendObjectSpec.class,
              com.google.storage.v2.AppendObjectSpec.Builder.class);
    }

    // Construct using com.google.storage.v2.AppendObjectSpec.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        internalGetWriteHandleFieldBuilder();
      }
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      bucket_ = "";
      object_ = "";
      generation_ = 0L;
      ifMetagenerationMatch_ = 0L;
      ifMetagenerationNotMatch_ = 0L;
      routingToken_ = "";
      writeHandle_ = null;
      if (writeHandleBuilder_ != null) {
        writeHandleBuilder_.dispose();
        writeHandleBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.storage.v2.StorageProto
          .internal_static_google_storage_v2_AppendObjectSpec_descriptor;
    }

    @java.lang.Override
    public com.google.storage.v2.AppendObjectSpec getDefaultInstanceForType() {
      return com.google.storage.v2.AppendObjectSpec.getDefaultInstance();
    }

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

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

    private void buildPartial0(com.google.storage.v2.AppendObjectSpec result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.bucket_ = bucket_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.object_ = object_;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.generation_ = generation_;
      }
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.ifMetagenerationMatch_ = ifMetagenerationMatch_;
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000010) != 0)) {
        result.ifMetagenerationNotMatch_ = ifMetagenerationNotMatch_;
        to_bitField0_ |= 0x00000002;
      }
      if (((from_bitField0_ & 0x00000020) != 0)) {
        result.routingToken_ = routingToken_;
        to_bitField0_ |= 0x00000004;
      }
      if (((from_bitField0_ & 0x00000040) != 0)) {
        result.writeHandle_ =
            writeHandleBuilder_ == null ? writeHandle_ : writeHandleBuilder_.build();
        to_bitField0_ |= 0x00000008;
      }
      result.bitField0_ |= to_bitField0_;
    }

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

    public Builder mergeFrom(com.google.storage.v2.AppendObjectSpec other) {
      if (other == com.google.storage.v2.AppendObjectSpec.getDefaultInstance()) return this;
      if (!other.getBucket().isEmpty()) {
        bucket_ = other.bucket_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (!other.getObject().isEmpty()) {
        object_ = other.object_;
        bitField0_ |= 0x00000002;
        onChanged();
      }
      if (other.getGeneration() != 0L) {
        setGeneration(other.getGeneration());
      }
      if (other.hasIfMetagenerationMatch()) {
        setIfMetagenerationMatch(other.getIfMetagenerationMatch());
      }
      if (other.hasIfMetagenerationNotMatch()) {
        setIfMetagenerationNotMatch(other.getIfMetagenerationNotMatch());
      }
      if (other.hasRoutingToken()) {
        routingToken_ = other.routingToken_;
        bitField0_ |= 0x00000020;
        onChanged();
      }
      if (other.hasWriteHandle()) {
        mergeWriteHandle(other.getWriteHandle());
      }
      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:
              {
                bucket_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                object_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 24:
              {
                generation_ = input.readInt64();
                bitField0_ |= 0x00000004;
                break;
              } // case 24
            case 32:
              {
                ifMetagenerationMatch_ = input.readInt64();
                bitField0_ |= 0x00000008;
                break;
              } // case 32
            case 40:
              {
                ifMetagenerationNotMatch_ = input.readInt64();
                bitField0_ |= 0x00000010;
                break;
              } // case 40
            case 50:
              {
                routingToken_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000020;
                break;
              } // case 50
            case 58:
              {
                input.readMessage(
                    internalGetWriteHandleFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000040;
                break;
              } // case 58
            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 bucket_ = "";

    /**
     *
     *
     * <pre>
     * Required. The name of the bucket containing the object to write.
     * </pre>
     *
     * <code>
     * string bucket = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The bucket.
     */
    public java.lang.String getBucket() {
      java.lang.Object ref = bucket_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        bucket_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Required. The name of the bucket containing the object to write.
     * </pre>
     *
     * <code>
     * string bucket = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The bytes for bucket.
     */
    public com.google.protobuf.ByteString getBucketBytes() {
      java.lang.Object ref = bucket_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        bucket_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Required. The name of the bucket containing the object to write.
     * </pre>
     *
     * <code>
     * string bucket = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @param value The bucket to set.
     * @return This builder for chaining.
     */
    public Builder setBucket(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      bucket_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Required. The name of the bucket containing the object to write.
     * </pre>
     *
     * <code>
     * string bucket = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return This builder for chaining.
     */
    public Builder clearBucket() {
      bucket_ = getDefaultInstance().getBucket();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Required. The name of the bucket containing the object to write.
     * </pre>
     *
     * <code>
     * string bucket = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @param value The bytes for bucket to set.
     * @return This builder for chaining.
     */
    public Builder setBucketBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      bucket_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    private java.lang.Object object_ = "";

    /**
     *
     *
     * <pre>
     * Required. The name of the object to open for writing.
     * </pre>
     *
     * <code>string object = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return The object.
     */
    public java.lang.String getObject() {
      java.lang.Object ref = object_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        object_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Required. The name of the object to open for writing.
     * </pre>
     *
     * <code>string object = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return The bytes for object.
     */
    public com.google.protobuf.ByteString getObjectBytes() {
      java.lang.Object ref = object_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        object_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Required. The name of the object to open for writing.
     * </pre>
     *
     * <code>string object = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @param value The object to set.
     * @return This builder for chaining.
     */
    public Builder setObject(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      object_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Required. The name of the object to open for writing.
     * </pre>
     *
     * <code>string object = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearObject() {
      object_ = getDefaultInstance().getObject();
      bitField0_ = (bitField0_ & ~0x00000002);
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Required. The name of the object to open for writing.
     * </pre>
     *
     * <code>string object = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @param value The bytes for object to set.
     * @return This builder for chaining.
     */
    public Builder setObjectBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      object_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    private long generation_;

    /**
     *
     *
     * <pre>
     * Required. The generation number of the object to open for writing.
     * </pre>
     *
     * <code>int64 generation = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return The generation.
     */
    @java.lang.Override
    public long getGeneration() {
      return generation_;
    }

    /**
     *
     *
     * <pre>
     * Required. The generation number of the object to open for writing.
     * </pre>
     *
     * <code>int64 generation = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @param value The generation to set.
     * @return This builder for chaining.
     */
    public Builder setGeneration(long value) {

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

    /**
     *
     *
     * <pre>
     * Required. The generation number of the object to open for writing.
     * </pre>
     *
     * <code>int64 generation = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearGeneration() {
      bitField0_ = (bitField0_ & ~0x00000004);
      generation_ = 0L;
      onChanged();
      return this;
    }

    private long ifMetagenerationMatch_;

    /**
     *
     *
     * <pre>
     * Makes the operation conditional on whether the object's current
     * metageneration matches the given value.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional int64 if_metageneration_match = 4;</code>
     *
     * @return Whether the ifMetagenerationMatch field is set.
     */
    @java.lang.Override
    public boolean hasIfMetagenerationMatch() {
      return ((bitField0_ & 0x00000008) != 0);
    }

    /**
     *
     *
     * <pre>
     * Makes the operation conditional on whether the object's current
     * metageneration matches the given value.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional int64 if_metageneration_match = 4;</code>
     *
     * @return The ifMetagenerationMatch.
     */
    @java.lang.Override
    public long getIfMetagenerationMatch() {
      return ifMetagenerationMatch_;
    }

    /**
     *
     *
     * <pre>
     * Makes the operation conditional on whether the object's current
     * metageneration matches the given value.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional int64 if_metageneration_match = 4;</code>
     *
     * @param value The ifMetagenerationMatch to set.
     * @return This builder for chaining.
     */
    public Builder setIfMetagenerationMatch(long value) {

      ifMetagenerationMatch_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Makes the operation conditional on whether the object's current
     * metageneration matches the given value.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional int64 if_metageneration_match = 4;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearIfMetagenerationMatch() {
      bitField0_ = (bitField0_ & ~0x00000008);
      ifMetagenerationMatch_ = 0L;
      onChanged();
      return this;
    }

    private long ifMetagenerationNotMatch_;

    /**
     *
     *
     * <pre>
     * Makes the operation conditional on whether the object's current
     * metageneration does not match the given value.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional int64 if_metageneration_not_match = 5;</code>
     *
     * @return Whether the ifMetagenerationNotMatch field is set.
     */
    @java.lang.Override
    public boolean hasIfMetagenerationNotMatch() {
      return ((bitField0_ & 0x00000010) != 0);
    }

    /**
     *
     *
     * <pre>
     * Makes the operation conditional on whether the object's current
     * metageneration does not match the given value.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional int64 if_metageneration_not_match = 5;</code>
     *
     * @return The ifMetagenerationNotMatch.
     */
    @java.lang.Override
    public long getIfMetagenerationNotMatch() {
      return ifMetagenerationNotMatch_;
    }

    /**
     *
     *
     * <pre>
     * Makes the operation conditional on whether the object's current
     * metageneration does not match the given value.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional int64 if_metageneration_not_match = 5;</code>
     *
     * @param value The ifMetagenerationNotMatch to set.
     * @return This builder for chaining.
     */
    public Builder setIfMetagenerationNotMatch(long value) {

      ifMetagenerationNotMatch_ = value;
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Makes the operation conditional on whether the object's current
     * metageneration does not match the given value.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional int64 if_metageneration_not_match = 5;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearIfMetagenerationNotMatch() {
      bitField0_ = (bitField0_ & ~0x00000010);
      ifMetagenerationNotMatch_ = 0L;
      onChanged();
      return this;
    }

    private java.lang.Object routingToken_ = "";

    /**
     *
     *
     * <pre>
     * An optional routing token that influences request routing for the stream.
     * Must be provided if a `BidiWriteObjectRedirectedError` is returned.
     * </pre>
     *
     * <code>optional string routing_token = 6;</code>
     *
     * @return Whether the routingToken field is set.
     */
    public boolean hasRoutingToken() {
      return ((bitField0_ & 0x00000020) != 0);
    }

    /**
     *
     *
     * <pre>
     * An optional routing token that influences request routing for the stream.
     * Must be provided if a `BidiWriteObjectRedirectedError` is returned.
     * </pre>
     *
     * <code>optional string routing_token = 6;</code>
     *
     * @return The routingToken.
     */
    public java.lang.String getRoutingToken() {
      java.lang.Object ref = routingToken_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        routingToken_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * An optional routing token that influences request routing for the stream.
     * Must be provided if a `BidiWriteObjectRedirectedError` is returned.
     * </pre>
     *
     * <code>optional string routing_token = 6;</code>
     *
     * @return The bytes for routingToken.
     */
    public com.google.protobuf.ByteString getRoutingTokenBytes() {
      java.lang.Object ref = routingToken_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        routingToken_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * An optional routing token that influences request routing for the stream.
     * Must be provided if a `BidiWriteObjectRedirectedError` is returned.
     * </pre>
     *
     * <code>optional string routing_token = 6;</code>
     *
     * @param value The routingToken to set.
     * @return This builder for chaining.
     */
    public Builder setRoutingToken(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      routingToken_ = value;
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * An optional routing token that influences request routing for the stream.
     * Must be provided if a `BidiWriteObjectRedirectedError` is returned.
     * </pre>
     *
     * <code>optional string routing_token = 6;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearRoutingToken() {
      routingToken_ = getDefaultInstance().getRoutingToken();
      bitField0_ = (bitField0_ & ~0x00000020);
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * An optional routing token that influences request routing for the stream.
     * Must be provided if a `BidiWriteObjectRedirectedError` is returned.
     * </pre>
     *
     * <code>optional string routing_token = 6;</code>
     *
     * @param value The bytes for routingToken to set.
     * @return This builder for chaining.
     */
    public Builder setRoutingTokenBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      routingToken_ = value;
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }

    private com.google.storage.v2.BidiWriteHandle writeHandle_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.storage.v2.BidiWriteHandle,
            com.google.storage.v2.BidiWriteHandle.Builder,
            com.google.storage.v2.BidiWriteHandleOrBuilder>
        writeHandleBuilder_;

    /**
     *
     *
     * <pre>
     * An optional write handle returned from a previous BidiWriteObjectResponse
     * message or a BidiWriteObjectRedirectedError error.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
     *
     * @return Whether the writeHandle field is set.
     */
    public boolean hasWriteHandle() {
      return ((bitField0_ & 0x00000040) != 0);
    }

    /**
     *
     *
     * <pre>
     * An optional write handle returned from a previous BidiWriteObjectResponse
     * message or a BidiWriteObjectRedirectedError error.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
     *
     * @return The writeHandle.
     */
    public com.google.storage.v2.BidiWriteHandle getWriteHandle() {
      if (writeHandleBuilder_ == null) {
        return writeHandle_ == null
            ? com.google.storage.v2.BidiWriteHandle.getDefaultInstance()
            : writeHandle_;
      } else {
        return writeHandleBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * An optional write handle returned from a previous BidiWriteObjectResponse
     * message or a BidiWriteObjectRedirectedError error.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
     */
    public Builder setWriteHandle(com.google.storage.v2.BidiWriteHandle value) {
      if (writeHandleBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        writeHandle_ = value;
      } else {
        writeHandleBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * An optional write handle returned from a previous BidiWriteObjectResponse
     * message or a BidiWriteObjectRedirectedError error.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
     */
    public Builder setWriteHandle(com.google.storage.v2.BidiWriteHandle.Builder builderForValue) {
      if (writeHandleBuilder_ == null) {
        writeHandle_ = builderForValue.build();
      } else {
        writeHandleBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * An optional write handle returned from a previous BidiWriteObjectResponse
     * message or a BidiWriteObjectRedirectedError error.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
     */
    public Builder mergeWriteHandle(com.google.storage.v2.BidiWriteHandle value) {
      if (writeHandleBuilder_ == null) {
        if (((bitField0_ & 0x00000040) != 0)
            && writeHandle_ != null
            && writeHandle_ != com.google.storage.v2.BidiWriteHandle.getDefaultInstance()) {
          getWriteHandleBuilder().mergeFrom(value);
        } else {
          writeHandle_ = value;
        }
      } else {
        writeHandleBuilder_.mergeFrom(value);
      }
      if (writeHandle_ != null) {
        bitField0_ |= 0x00000040;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * An optional write handle returned from a previous BidiWriteObjectResponse
     * message or a BidiWriteObjectRedirectedError error.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
     */
    public Builder clearWriteHandle() {
      bitField0_ = (bitField0_ & ~0x00000040);
      writeHandle_ = null;
      if (writeHandleBuilder_ != null) {
        writeHandleBuilder_.dispose();
        writeHandleBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * An optional write handle returned from a previous BidiWriteObjectResponse
     * message or a BidiWriteObjectRedirectedError error.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
     */
    public com.google.storage.v2.BidiWriteHandle.Builder getWriteHandleBuilder() {
      bitField0_ |= 0x00000040;
      onChanged();
      return internalGetWriteHandleFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * An optional write handle returned from a previous BidiWriteObjectResponse
     * message or a BidiWriteObjectRedirectedError error.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
     */
    public com.google.storage.v2.BidiWriteHandleOrBuilder getWriteHandleOrBuilder() {
      if (writeHandleBuilder_ != null) {
        return writeHandleBuilder_.getMessageOrBuilder();
      } else {
        return writeHandle_ == null
            ? com.google.storage.v2.BidiWriteHandle.getDefaultInstance()
            : writeHandle_;
      }
    }

    /**
     *
     *
     * <pre>
     * An optional write handle returned from a previous BidiWriteObjectResponse
     * message or a BidiWriteObjectRedirectedError error.
     *
     * Note that metageneration preconditions are only checked if `write_handle`
     * is empty.
     * </pre>
     *
     * <code>optional .google.storage.v2.BidiWriteHandle write_handle = 7;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.storage.v2.BidiWriteHandle,
            com.google.storage.v2.BidiWriteHandle.Builder,
            com.google.storage.v2.BidiWriteHandleOrBuilder>
        internalGetWriteHandleFieldBuilder() {
      if (writeHandleBuilder_ == null) {
        writeHandleBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.storage.v2.BidiWriteHandle,
                com.google.storage.v2.BidiWriteHandle.Builder,
                com.google.storage.v2.BidiWriteHandleOrBuilder>(
                getWriteHandle(), getParentForChildren(), isClean());
        writeHandle_ = null;
      }
      return writeHandleBuilder_;
    }

    // @@protoc_insertion_point(builder_scope:google.storage.v2.AppendObjectSpec)
  }

  // @@protoc_insertion_point(class_scope:google.storage.v2.AppendObjectSpec)
  private static final com.google.storage.v2.AppendObjectSpec DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.storage.v2.AppendObjectSpec();
  }

  public static com.google.storage.v2.AppendObjectSpec getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public com.google.storage.v2.AppendObjectSpec getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
