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

package com.google.cloud.compute.v1;

/**
 *
 *
 * <pre>
 * </pre>
 *
 * Protobuf type {@code google.cloud.compute.v1.ExchangedPeeringRoute}
 */
public final class ExchangedPeeringRoute extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.compute.v1.ExchangedPeeringRoute)
    ExchangedPeeringRouteOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use ExchangedPeeringRoute.newBuilder() to construct.
  private ExchangedPeeringRoute(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private ExchangedPeeringRoute() {
    destRange_ = "";
    nextHopRegion_ = "";
    type_ = "";
  }

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

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

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.compute.v1.Compute
        .internal_static_google_cloud_compute_v1_ExchangedPeeringRoute_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.compute.v1.Compute
        .internal_static_google_cloud_compute_v1_ExchangedPeeringRoute_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.compute.v1.ExchangedPeeringRoute.class,
            com.google.cloud.compute.v1.ExchangedPeeringRoute.Builder.class);
  }

  /**
   *
   *
   * <pre>
   * The type of the peering route.
   * </pre>
   *
   * Protobuf enum {@code google.cloud.compute.v1.ExchangedPeeringRoute.Type}
   */
  public enum Type implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * A value indicating that the enum field is not set.
     * </pre>
     *
     * <code>UNDEFINED_TYPE = 0;</code>
     */
    UNDEFINED_TYPE(0),
    /**
     *
     *
     * <pre>
     * For routes exported from local network.
     * </pre>
     *
     * <code>DYNAMIC_PEERING_ROUTE = 469794858;</code>
     */
    DYNAMIC_PEERING_ROUTE(469794858),
    /**
     *
     *
     * <pre>
     * The peering route.
     * </pre>
     *
     * <code>STATIC_PEERING_ROUTE = 473407545;</code>
     */
    STATIC_PEERING_ROUTE(473407545),
    /**
     *
     *
     * <pre>
     * The peering route corresponding to subnetwork range.
     * </pre>
     *
     * <code>SUBNET_PEERING_ROUTE = 465782504;</code>
     */
    SUBNET_PEERING_ROUTE(465782504),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * A value indicating that the enum field is not set.
     * </pre>
     *
     * <code>UNDEFINED_TYPE = 0;</code>
     */
    public static final int UNDEFINED_TYPE_VALUE = 0;
    /**
     *
     *
     * <pre>
     * For routes exported from local network.
     * </pre>
     *
     * <code>DYNAMIC_PEERING_ROUTE = 469794858;</code>
     */
    public static final int DYNAMIC_PEERING_ROUTE_VALUE = 469794858;
    /**
     *
     *
     * <pre>
     * The peering route.
     * </pre>
     *
     * <code>STATIC_PEERING_ROUTE = 473407545;</code>
     */
    public static final int STATIC_PEERING_ROUTE_VALUE = 473407545;
    /**
     *
     *
     * <pre>
     * The peering route corresponding to subnetwork range.
     * </pre>
     *
     * <code>SUBNET_PEERING_ROUTE = 465782504;</code>
     */
    public static final int SUBNET_PEERING_ROUTE_VALUE = 465782504;

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

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

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     */
    public static Type forNumber(int value) {
      switch (value) {
        case 0:
          return UNDEFINED_TYPE;
        case 469794858:
          return DYNAMIC_PEERING_ROUTE;
        case 473407545:
          return STATIC_PEERING_ROUTE;
        case 465782504:
          return SUBNET_PEERING_ROUTE;
        default:
          return null;
      }
    }

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

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

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

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

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

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

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

    private final int value;

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

    // @@protoc_insertion_point(enum_scope:google.cloud.compute.v1.ExchangedPeeringRoute.Type)
  }

  private int bitField0_;
  public static final int DEST_RANGE_FIELD_NUMBER = 381327712;

  @SuppressWarnings("serial")
  private volatile java.lang.Object destRange_ = "";
  /**
   *
   *
   * <pre>
   * The destination range of the route.
   * </pre>
   *
   * <code>optional string dest_range = 381327712;</code>
   *
   * @return Whether the destRange field is set.
   */
  @java.lang.Override
  public boolean hasDestRange() {
    return ((bitField0_ & 0x00000001) != 0);
  }
  /**
   *
   *
   * <pre>
   * The destination range of the route.
   * </pre>
   *
   * <code>optional string dest_range = 381327712;</code>
   *
   * @return The destRange.
   */
  @java.lang.Override
  public java.lang.String getDestRange() {
    java.lang.Object ref = destRange_;
    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();
      destRange_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The destination range of the route.
   * </pre>
   *
   * <code>optional string dest_range = 381327712;</code>
   *
   * @return The bytes for destRange.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getDestRangeBytes() {
    java.lang.Object ref = destRange_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      destRange_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int IMPORTED_FIELD_NUMBER = 114502404;
  private boolean imported_ = false;
  /**
   *
   *
   * <pre>
   * True if the peering route has been imported from a peer. The actual import happens if the field networkPeering.importCustomRoutes is true for this network, and networkPeering.exportCustomRoutes is true for the peer network, and the import does not result in a route conflict.
   * </pre>
   *
   * <code>optional bool imported = 114502404;</code>
   *
   * @return Whether the imported field is set.
   */
  @java.lang.Override
  public boolean hasImported() {
    return ((bitField0_ & 0x00000002) != 0);
  }
  /**
   *
   *
   * <pre>
   * True if the peering route has been imported from a peer. The actual import happens if the field networkPeering.importCustomRoutes is true for this network, and networkPeering.exportCustomRoutes is true for the peer network, and the import does not result in a route conflict.
   * </pre>
   *
   * <code>optional bool imported = 114502404;</code>
   *
   * @return The imported.
   */
  @java.lang.Override
  public boolean getImported() {
    return imported_;
  }

  public static final int NEXT_HOP_REGION_FIELD_NUMBER = 122577014;

  @SuppressWarnings("serial")
  private volatile java.lang.Object nextHopRegion_ = "";
  /**
   *
   *
   * <pre>
   * The region of peering route next hop, only applies to dynamic routes.
   * </pre>
   *
   * <code>optional string next_hop_region = 122577014;</code>
   *
   * @return Whether the nextHopRegion field is set.
   */
  @java.lang.Override
  public boolean hasNextHopRegion() {
    return ((bitField0_ & 0x00000004) != 0);
  }
  /**
   *
   *
   * <pre>
   * The region of peering route next hop, only applies to dynamic routes.
   * </pre>
   *
   * <code>optional string next_hop_region = 122577014;</code>
   *
   * @return The nextHopRegion.
   */
  @java.lang.Override
  public java.lang.String getNextHopRegion() {
    java.lang.Object ref = nextHopRegion_;
    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();
      nextHopRegion_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The region of peering route next hop, only applies to dynamic routes.
   * </pre>
   *
   * <code>optional string next_hop_region = 122577014;</code>
   *
   * @return The bytes for nextHopRegion.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getNextHopRegionBytes() {
    java.lang.Object ref = nextHopRegion_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      nextHopRegion_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int PRIORITY_FIELD_NUMBER = 445151652;
  private int priority_ = 0;
  /**
   *
   *
   * <pre>
   * The priority of the peering route.
   * </pre>
   *
   * <code>optional uint32 priority = 445151652;</code>
   *
   * @return Whether the priority field is set.
   */
  @java.lang.Override
  public boolean hasPriority() {
    return ((bitField0_ & 0x00000008) != 0);
  }
  /**
   *
   *
   * <pre>
   * The priority of the peering route.
   * </pre>
   *
   * <code>optional uint32 priority = 445151652;</code>
   *
   * @return The priority.
   */
  @java.lang.Override
  public int getPriority() {
    return priority_;
  }

  public static final int TYPE_FIELD_NUMBER = 3575610;

  @SuppressWarnings("serial")
  private volatile java.lang.Object type_ = "";
  /**
   *
   *
   * <pre>
   * The type of the peering route.
   * Check the Type enum for the list of possible values.
   * </pre>
   *
   * <code>optional string type = 3575610;</code>
   *
   * @return Whether the type field is set.
   */
  @java.lang.Override
  public boolean hasType() {
    return ((bitField0_ & 0x00000010) != 0);
  }
  /**
   *
   *
   * <pre>
   * The type of the peering route.
   * Check the Type enum for the list of possible values.
   * </pre>
   *
   * <code>optional string type = 3575610;</code>
   *
   * @return The type.
   */
  @java.lang.Override
  public java.lang.String getType() {
    java.lang.Object ref = type_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      type_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The type of the peering route.
   * Check the Type enum for the list of possible values.
   * </pre>
   *
   * <code>optional string type = 3575610;</code>
   *
   * @return The bytes for type.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getTypeBytes() {
    java.lang.Object ref = type_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      type_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  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 (((bitField0_ & 0x00000010) != 0)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3575610, type_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      output.writeBool(114502404, imported_);
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 122577014, nextHopRegion_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 381327712, destRange_);
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      output.writeUInt32(445151652, priority_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (((bitField0_ & 0x00000010) != 0)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3575610, type_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeBoolSize(114502404, imported_);
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(122577014, nextHopRegion_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(381327712, destRange_);
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeUInt32Size(445151652, priority_);
    }
    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.cloud.compute.v1.ExchangedPeeringRoute)) {
      return super.equals(obj);
    }
    com.google.cloud.compute.v1.ExchangedPeeringRoute other =
        (com.google.cloud.compute.v1.ExchangedPeeringRoute) obj;

    if (hasDestRange() != other.hasDestRange()) return false;
    if (hasDestRange()) {
      if (!getDestRange().equals(other.getDestRange())) return false;
    }
    if (hasImported() != other.hasImported()) return false;
    if (hasImported()) {
      if (getImported() != other.getImported()) return false;
    }
    if (hasNextHopRegion() != other.hasNextHopRegion()) return false;
    if (hasNextHopRegion()) {
      if (!getNextHopRegion().equals(other.getNextHopRegion())) return false;
    }
    if (hasPriority() != other.hasPriority()) return false;
    if (hasPriority()) {
      if (getPriority() != other.getPriority()) return false;
    }
    if (hasType() != other.hasType()) return false;
    if (hasType()) {
      if (!getType().equals(other.getType())) return false;
    }
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasDestRange()) {
      hash = (37 * hash) + DEST_RANGE_FIELD_NUMBER;
      hash = (53 * hash) + getDestRange().hashCode();
    }
    if (hasImported()) {
      hash = (37 * hash) + IMPORTED_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getImported());
    }
    if (hasNextHopRegion()) {
      hash = (37 * hash) + NEXT_HOP_REGION_FIELD_NUMBER;
      hash = (53 * hash) + getNextHopRegion().hashCode();
    }
    if (hasPriority()) {
      hash = (37 * hash) + PRIORITY_FIELD_NUMBER;
      hash = (53 * hash) + getPriority();
    }
    if (hasType()) {
      hash = (37 * hash) + TYPE_FIELD_NUMBER;
      hash = (53 * hash) + getType().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

  public static com.google.cloud.compute.v1.ExchangedPeeringRoute parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

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

  public static com.google.cloud.compute.v1.ExchangedPeeringRoute 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.cloud.compute.v1.ExchangedPeeringRoute 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>
   * </pre>
   *
   * Protobuf type {@code google.cloud.compute.v1.ExchangedPeeringRoute}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.compute.v1.ExchangedPeeringRoute)
      com.google.cloud.compute.v1.ExchangedPeeringRouteOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.compute.v1.Compute
          .internal_static_google_cloud_compute_v1_ExchangedPeeringRoute_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.compute.v1.Compute
          .internal_static_google_cloud_compute_v1_ExchangedPeeringRoute_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.compute.v1.ExchangedPeeringRoute.class,
              com.google.cloud.compute.v1.ExchangedPeeringRoute.Builder.class);
    }

    // Construct using com.google.cloud.compute.v1.ExchangedPeeringRoute.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      destRange_ = "";
      imported_ = false;
      nextHopRegion_ = "";
      priority_ = 0;
      type_ = "";
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.compute.v1.Compute
          .internal_static_google_cloud_compute_v1_ExchangedPeeringRoute_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.compute.v1.ExchangedPeeringRoute getDefaultInstanceForType() {
      return com.google.cloud.compute.v1.ExchangedPeeringRoute.getDefaultInstance();
    }

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

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

    private void buildPartial0(com.google.cloud.compute.v1.ExchangedPeeringRoute result) {
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.destRange_ = destRange_;
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.imported_ = imported_;
        to_bitField0_ |= 0x00000002;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.nextHopRegion_ = nextHopRegion_;
        to_bitField0_ |= 0x00000004;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.priority_ = priority_;
        to_bitField0_ |= 0x00000008;
      }
      if (((from_bitField0_ & 0x00000010) != 0)) {
        result.type_ = type_;
        to_bitField0_ |= 0x00000010;
      }
      result.bitField0_ |= to_bitField0_;
    }

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

    public Builder mergeFrom(com.google.cloud.compute.v1.ExchangedPeeringRoute other) {
      if (other == com.google.cloud.compute.v1.ExchangedPeeringRoute.getDefaultInstance())
        return this;
      if (other.hasDestRange()) {
        destRange_ = other.destRange_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (other.hasImported()) {
        setImported(other.getImported());
      }
      if (other.hasNextHopRegion()) {
        nextHopRegion_ = other.nextHopRegion_;
        bitField0_ |= 0x00000004;
        onChanged();
      }
      if (other.hasPriority()) {
        setPriority(other.getPriority());
      }
      if (other.hasType()) {
        type_ = other.type_;
        bitField0_ |= 0x00000010;
        onChanged();
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 28604882:
              {
                type_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000010;
                break;
              } // case 28604882
            case 916019232:
              {
                imported_ = input.readBool();
                bitField0_ |= 0x00000002;
                break;
              } // case 916019232
            case 980616114:
              {
                nextHopRegion_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000004;
                break;
              } // case 980616114
            case -1244345598:
              {
                destRange_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case -1244345598
            case -733754080:
              {
                priority_ = input.readUInt32();
                bitField0_ |= 0x00000008;
                break;
              } // case -733754080
            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 destRange_ = "";
    /**
     *
     *
     * <pre>
     * The destination range of the route.
     * </pre>
     *
     * <code>optional string dest_range = 381327712;</code>
     *
     * @return Whether the destRange field is set.
     */
    public boolean hasDestRange() {
      return ((bitField0_ & 0x00000001) != 0);
    }
    /**
     *
     *
     * <pre>
     * The destination range of the route.
     * </pre>
     *
     * <code>optional string dest_range = 381327712;</code>
     *
     * @return The destRange.
     */
    public java.lang.String getDestRange() {
      java.lang.Object ref = destRange_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        destRange_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The destination range of the route.
     * </pre>
     *
     * <code>optional string dest_range = 381327712;</code>
     *
     * @return The bytes for destRange.
     */
    public com.google.protobuf.ByteString getDestRangeBytes() {
      java.lang.Object ref = destRange_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        destRange_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The destination range of the route.
     * </pre>
     *
     * <code>optional string dest_range = 381327712;</code>
     *
     * @param value The destRange to set.
     * @return This builder for chaining.
     */
    public Builder setDestRange(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      destRange_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The destination range of the route.
     * </pre>
     *
     * <code>optional string dest_range = 381327712;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearDestRange() {
      destRange_ = getDefaultInstance().getDestRange();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The destination range of the route.
     * </pre>
     *
     * <code>optional string dest_range = 381327712;</code>
     *
     * @param value The bytes for destRange to set.
     * @return This builder for chaining.
     */
    public Builder setDestRangeBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      destRange_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    private boolean imported_;
    /**
     *
     *
     * <pre>
     * True if the peering route has been imported from a peer. The actual import happens if the field networkPeering.importCustomRoutes is true for this network, and networkPeering.exportCustomRoutes is true for the peer network, and the import does not result in a route conflict.
     * </pre>
     *
     * <code>optional bool imported = 114502404;</code>
     *
     * @return Whether the imported field is set.
     */
    @java.lang.Override
    public boolean hasImported() {
      return ((bitField0_ & 0x00000002) != 0);
    }
    /**
     *
     *
     * <pre>
     * True if the peering route has been imported from a peer. The actual import happens if the field networkPeering.importCustomRoutes is true for this network, and networkPeering.exportCustomRoutes is true for the peer network, and the import does not result in a route conflict.
     * </pre>
     *
     * <code>optional bool imported = 114502404;</code>
     *
     * @return The imported.
     */
    @java.lang.Override
    public boolean getImported() {
      return imported_;
    }
    /**
     *
     *
     * <pre>
     * True if the peering route has been imported from a peer. The actual import happens if the field networkPeering.importCustomRoutes is true for this network, and networkPeering.exportCustomRoutes is true for the peer network, and the import does not result in a route conflict.
     * </pre>
     *
     * <code>optional bool imported = 114502404;</code>
     *
     * @param value The imported to set.
     * @return This builder for chaining.
     */
    public Builder setImported(boolean value) {

      imported_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * True if the peering route has been imported from a peer. The actual import happens if the field networkPeering.importCustomRoutes is true for this network, and networkPeering.exportCustomRoutes is true for the peer network, and the import does not result in a route conflict.
     * </pre>
     *
     * <code>optional bool imported = 114502404;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearImported() {
      bitField0_ = (bitField0_ & ~0x00000002);
      imported_ = false;
      onChanged();
      return this;
    }

    private java.lang.Object nextHopRegion_ = "";
    /**
     *
     *
     * <pre>
     * The region of peering route next hop, only applies to dynamic routes.
     * </pre>
     *
     * <code>optional string next_hop_region = 122577014;</code>
     *
     * @return Whether the nextHopRegion field is set.
     */
    public boolean hasNextHopRegion() {
      return ((bitField0_ & 0x00000004) != 0);
    }
    /**
     *
     *
     * <pre>
     * The region of peering route next hop, only applies to dynamic routes.
     * </pre>
     *
     * <code>optional string next_hop_region = 122577014;</code>
     *
     * @return The nextHopRegion.
     */
    public java.lang.String getNextHopRegion() {
      java.lang.Object ref = nextHopRegion_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        nextHopRegion_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The region of peering route next hop, only applies to dynamic routes.
     * </pre>
     *
     * <code>optional string next_hop_region = 122577014;</code>
     *
     * @return The bytes for nextHopRegion.
     */
    public com.google.protobuf.ByteString getNextHopRegionBytes() {
      java.lang.Object ref = nextHopRegion_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        nextHopRegion_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The region of peering route next hop, only applies to dynamic routes.
     * </pre>
     *
     * <code>optional string next_hop_region = 122577014;</code>
     *
     * @param value The nextHopRegion to set.
     * @return This builder for chaining.
     */
    public Builder setNextHopRegion(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      nextHopRegion_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The region of peering route next hop, only applies to dynamic routes.
     * </pre>
     *
     * <code>optional string next_hop_region = 122577014;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearNextHopRegion() {
      nextHopRegion_ = getDefaultInstance().getNextHopRegion();
      bitField0_ = (bitField0_ & ~0x00000004);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The region of peering route next hop, only applies to dynamic routes.
     * </pre>
     *
     * <code>optional string next_hop_region = 122577014;</code>
     *
     * @param value The bytes for nextHopRegion to set.
     * @return This builder for chaining.
     */
    public Builder setNextHopRegionBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      nextHopRegion_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    private int priority_;
    /**
     *
     *
     * <pre>
     * The priority of the peering route.
     * </pre>
     *
     * <code>optional uint32 priority = 445151652;</code>
     *
     * @return Whether the priority field is set.
     */
    @java.lang.Override
    public boolean hasPriority() {
      return ((bitField0_ & 0x00000008) != 0);
    }
    /**
     *
     *
     * <pre>
     * The priority of the peering route.
     * </pre>
     *
     * <code>optional uint32 priority = 445151652;</code>
     *
     * @return The priority.
     */
    @java.lang.Override
    public int getPriority() {
      return priority_;
    }
    /**
     *
     *
     * <pre>
     * The priority of the peering route.
     * </pre>
     *
     * <code>optional uint32 priority = 445151652;</code>
     *
     * @param value The priority to set.
     * @return This builder for chaining.
     */
    public Builder setPriority(int value) {

      priority_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The priority of the peering route.
     * </pre>
     *
     * <code>optional uint32 priority = 445151652;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearPriority() {
      bitField0_ = (bitField0_ & ~0x00000008);
      priority_ = 0;
      onChanged();
      return this;
    }

    private java.lang.Object type_ = "";
    /**
     *
     *
     * <pre>
     * The type of the peering route.
     * Check the Type enum for the list of possible values.
     * </pre>
     *
     * <code>optional string type = 3575610;</code>
     *
     * @return Whether the type field is set.
     */
    public boolean hasType() {
      return ((bitField0_ & 0x00000010) != 0);
    }
    /**
     *
     *
     * <pre>
     * The type of the peering route.
     * Check the Type enum for the list of possible values.
     * </pre>
     *
     * <code>optional string type = 3575610;</code>
     *
     * @return The type.
     */
    public java.lang.String getType() {
      java.lang.Object ref = type_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        type_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The type of the peering route.
     * Check the Type enum for the list of possible values.
     * </pre>
     *
     * <code>optional string type = 3575610;</code>
     *
     * @return The bytes for type.
     */
    public com.google.protobuf.ByteString getTypeBytes() {
      java.lang.Object ref = type_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        type_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The type of the peering route.
     * Check the Type enum for the list of possible values.
     * </pre>
     *
     * <code>optional string type = 3575610;</code>
     *
     * @param value The type to set.
     * @return This builder for chaining.
     */
    public Builder setType(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      type_ = value;
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The type of the peering route.
     * Check the Type enum for the list of possible values.
     * </pre>
     *
     * <code>optional string type = 3575610;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearType() {
      type_ = getDefaultInstance().getType();
      bitField0_ = (bitField0_ & ~0x00000010);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The type of the peering route.
     * Check the Type enum for the list of possible values.
     * </pre>
     *
     * <code>optional string type = 3575610;</code>
     *
     * @param value The bytes for type to set.
     * @return This builder for chaining.
     */
    public Builder setTypeBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      type_ = value;
      bitField0_ |= 0x00000010;
      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.cloud.compute.v1.ExchangedPeeringRoute)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.compute.v1.ExchangedPeeringRoute)
  private static final com.google.cloud.compute.v1.ExchangedPeeringRoute DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.compute.v1.ExchangedPeeringRoute();
  }

  public static com.google.cloud.compute.v1.ExchangedPeeringRoute getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public com.google.cloud.compute.v1.ExchangedPeeringRoute getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
