// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/devtools/clouderrorreporting/v1beta1/common.proto

package com.google.devtools.clouderrorreporting.v1beta1;

/**
 *
 *
 * <pre>
 * A description of the context in which an error occurred.
 * This data should be provided by the application when reporting an error,
 * unless the
 * error report has been generated automatically from Google App Engine logs.
 * </pre>
 *
 * Protobuf type {@code google.devtools.clouderrorreporting.v1beta1.ErrorContext}
 */
public final class ErrorContext extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.devtools.clouderrorreporting.v1beta1.ErrorContext)
    ErrorContextOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use ErrorContext.newBuilder() to construct.
  private ErrorContext(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private ErrorContext() {
    user_ = "";
  }

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

  private ErrorContext(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10:
            {
              com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder
                  subBuilder = null;
              if (httpRequest_ != null) {
                subBuilder = httpRequest_.toBuilder();
              }
              httpRequest_ =
                  input.readMessage(
                      com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(httpRequest_);
                httpRequest_ = subBuilder.buildPartial();
              }

              break;
            }
          case 18:
            {
              java.lang.String s = input.readStringRequireUtf8();

              user_ = s;
              break;
            }
          case 26:
            {
              com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder subBuilder =
                  null;
              if (reportLocation_ != null) {
                subBuilder = reportLocation_.toBuilder();
              }
              reportLocation_ =
                  input.readMessage(
                      com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(reportLocation_);
                reportLocation_ = subBuilder.buildPartial();
              }

              break;
            }
          default:
            {
              if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
        .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
        .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.class,
            com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.Builder.class);
  }

  public static final int HTTP_REQUEST_FIELD_NUMBER = 1;
  private com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext httpRequest_;
  /**
   *
   *
   * <pre>
   * The HTTP request which was processed when the error was
   * triggered.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;</code>
   */
  public boolean hasHttpRequest() {
    return httpRequest_ != null;
  }
  /**
   *
   *
   * <pre>
   * The HTTP request which was processed when the error was
   * triggered.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;</code>
   */
  public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext getHttpRequest() {
    return httpRequest_ == null
        ? com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.getDefaultInstance()
        : httpRequest_;
  }
  /**
   *
   *
   * <pre>
   * The HTTP request which was processed when the error was
   * triggered.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;</code>
   */
  public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder
      getHttpRequestOrBuilder() {
    return getHttpRequest();
  }

  public static final int USER_FIELD_NUMBER = 2;
  private volatile java.lang.Object user_;
  /**
   *
   *
   * <pre>
   * The user who caused or was affected by the crash.
   * This can be a user ID, an email address, or an arbitrary token that
   * uniquely identifies the user.
   * When sending an error report, leave this field empty if the user was not
   * logged in. In this case the
   * Error Reporting system will use other data, such as remote IP address, to
   * distinguish affected users. See `affected_users_count` in
   * `ErrorGroupStats`.
   * </pre>
   *
   * <code>string user = 2;</code>
   */
  public java.lang.String getUser() {
    java.lang.Object ref = user_;
    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();
      user_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The user who caused or was affected by the crash.
   * This can be a user ID, an email address, or an arbitrary token that
   * uniquely identifies the user.
   * When sending an error report, leave this field empty if the user was not
   * logged in. In this case the
   * Error Reporting system will use other data, such as remote IP address, to
   * distinguish affected users. See `affected_users_count` in
   * `ErrorGroupStats`.
   * </pre>
   *
   * <code>string user = 2;</code>
   */
  public com.google.protobuf.ByteString getUserBytes() {
    java.lang.Object ref = user_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      user_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int REPORT_LOCATION_FIELD_NUMBER = 3;
  private com.google.devtools.clouderrorreporting.v1beta1.SourceLocation reportLocation_;
  /**
   *
   *
   * <pre>
   * The location in the source code where the decision was made to
   * report the error, usually the place where it was logged.
   * For a logged exception this would be the source line where the
   * exception is logged, usually close to the place where it was
   * caught. This value is in contrast to `Exception.cause_location`,
   * which describes the source line where the exception was thrown.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
   */
  public boolean hasReportLocation() {
    return reportLocation_ != null;
  }
  /**
   *
   *
   * <pre>
   * The location in the source code where the decision was made to
   * report the error, usually the place where it was logged.
   * For a logged exception this would be the source line where the
   * exception is logged, usually close to the place where it was
   * caught. This value is in contrast to `Exception.cause_location`,
   * which describes the source line where the exception was thrown.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
   */
  public com.google.devtools.clouderrorreporting.v1beta1.SourceLocation getReportLocation() {
    return reportLocation_ == null
        ? com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.getDefaultInstance()
        : reportLocation_;
  }
  /**
   *
   *
   * <pre>
   * The location in the source code where the decision was made to
   * report the error, usually the place where it was logged.
   * For a logged exception this would be the source line where the
   * exception is logged, usually close to the place where it was
   * caught. This value is in contrast to `Exception.cause_location`,
   * which describes the source line where the exception was thrown.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
   */
  public com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder
      getReportLocationOrBuilder() {
    return getReportLocation();
  }

  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 (httpRequest_ != null) {
      output.writeMessage(1, getHttpRequest());
    }
    if (!getUserBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, user_);
    }
    if (reportLocation_ != null) {
      output.writeMessage(3, getReportLocation());
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (httpRequest_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getHttpRequest());
    }
    if (!getUserBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, user_);
    }
    if (reportLocation_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getReportLocation());
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.devtools.clouderrorreporting.v1beta1.ErrorContext)) {
      return super.equals(obj);
    }
    com.google.devtools.clouderrorreporting.v1beta1.ErrorContext other =
        (com.google.devtools.clouderrorreporting.v1beta1.ErrorContext) obj;

    if (hasHttpRequest() != other.hasHttpRequest()) return false;
    if (hasHttpRequest()) {
      if (!getHttpRequest().equals(other.getHttpRequest())) return false;
    }
    if (!getUser().equals(other.getUser())) return false;
    if (hasReportLocation() != other.hasReportLocation()) return false;
    if (hasReportLocation()) {
      if (!getReportLocation().equals(other.getReportLocation())) return false;
    }
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasHttpRequest()) {
      hash = (37 * hash) + HTTP_REQUEST_FIELD_NUMBER;
      hash = (53 * hash) + getHttpRequest().hashCode();
    }
    hash = (37 * hash) + USER_FIELD_NUMBER;
    hash = (53 * hash) + getUser().hashCode();
    if (hasReportLocation()) {
      hash = (37 * hash) + REPORT_LOCATION_FIELD_NUMBER;
      hash = (53 * hash) + getReportLocation().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

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

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

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext 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.devtools.clouderrorreporting.v1beta1.ErrorContext 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>
   * A description of the context in which an error occurred.
   * This data should be provided by the application when reporting an error,
   * unless the
   * error report has been generated automatically from Google App Engine logs.
   * </pre>
   *
   * Protobuf type {@code google.devtools.clouderrorreporting.v1beta1.ErrorContext}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.devtools.clouderrorreporting.v1beta1.ErrorContext)
      com.google.devtools.clouderrorreporting.v1beta1.ErrorContextOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
          .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
          .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.class,
              com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.Builder.class);
    }

    // Construct using com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (httpRequestBuilder_ == null) {
        httpRequest_ = null;
      } else {
        httpRequest_ = null;
        httpRequestBuilder_ = null;
      }
      user_ = "";

      if (reportLocationBuilder_ == null) {
        reportLocation_ = null;
      } else {
        reportLocation_ = null;
        reportLocationBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
          .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_descriptor;
    }

    @java.lang.Override
    public com.google.devtools.clouderrorreporting.v1beta1.ErrorContext
        getDefaultInstanceForType() {
      return com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.devtools.clouderrorreporting.v1beta1.ErrorContext build() {
      com.google.devtools.clouderrorreporting.v1beta1.ErrorContext result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.devtools.clouderrorreporting.v1beta1.ErrorContext buildPartial() {
      com.google.devtools.clouderrorreporting.v1beta1.ErrorContext result =
          new com.google.devtools.clouderrorreporting.v1beta1.ErrorContext(this);
      if (httpRequestBuilder_ == null) {
        result.httpRequest_ = httpRequest_;
      } else {
        result.httpRequest_ = httpRequestBuilder_.build();
      }
      result.user_ = user_;
      if (reportLocationBuilder_ == null) {
        result.reportLocation_ = reportLocation_;
      } else {
        result.reportLocation_ = reportLocationBuilder_.build();
      }
      onBuilt();
      return result;
    }

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

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

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

    public Builder mergeFrom(com.google.devtools.clouderrorreporting.v1beta1.ErrorContext other) {
      if (other
          == com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.getDefaultInstance())
        return this;
      if (other.hasHttpRequest()) {
        mergeHttpRequest(other.getHttpRequest());
      }
      if (!other.getUser().isEmpty()) {
        user_ = other.user_;
        onChanged();
      }
      if (other.hasReportLocation()) {
        mergeReportLocation(other.getReportLocation());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage =
            (com.google.devtools.clouderrorreporting.v1beta1.ErrorContext) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext httpRequest_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext,
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder,
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder>
        httpRequestBuilder_;
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public boolean hasHttpRequest() {
      return httpRequestBuilder_ != null || httpRequest_ != null;
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext getHttpRequest() {
      if (httpRequestBuilder_ == null) {
        return httpRequest_ == null
            ? com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext
                .getDefaultInstance()
            : httpRequest_;
      } else {
        return httpRequestBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public Builder setHttpRequest(
        com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext value) {
      if (httpRequestBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        httpRequest_ = value;
        onChanged();
      } else {
        httpRequestBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public Builder setHttpRequest(
        com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder
            builderForValue) {
      if (httpRequestBuilder_ == null) {
        httpRequest_ = builderForValue.build();
        onChanged();
      } else {
        httpRequestBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public Builder mergeHttpRequest(
        com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext value) {
      if (httpRequestBuilder_ == null) {
        if (httpRequest_ != null) {
          httpRequest_ =
              com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.newBuilder(
                      httpRequest_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          httpRequest_ = value;
        }
        onChanged();
      } else {
        httpRequestBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public Builder clearHttpRequest() {
      if (httpRequestBuilder_ == null) {
        httpRequest_ = null;
        onChanged();
      } else {
        httpRequest_ = null;
        httpRequestBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder
        getHttpRequestBuilder() {

      onChanged();
      return getHttpRequestFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder
        getHttpRequestOrBuilder() {
      if (httpRequestBuilder_ != null) {
        return httpRequestBuilder_.getMessageOrBuilder();
      } else {
        return httpRequest_ == null
            ? com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext
                .getDefaultInstance()
            : httpRequest_;
      }
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext,
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder,
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder>
        getHttpRequestFieldBuilder() {
      if (httpRequestBuilder_ == null) {
        httpRequestBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext,
                com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder,
                com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder>(
                getHttpRequest(), getParentForChildren(), isClean());
        httpRequest_ = null;
      }
      return httpRequestBuilder_;
    }

    private java.lang.Object user_ = "";
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     */
    public java.lang.String getUser() {
      java.lang.Object ref = user_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        user_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     */
    public com.google.protobuf.ByteString getUserBytes() {
      java.lang.Object ref = user_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        user_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     */
    public Builder setUser(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      user_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     */
    public Builder clearUser() {

      user_ = getDefaultInstance().getUser();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     */
    public Builder setUserBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      user_ = value;
      onChanged();
      return this;
    }

    private com.google.devtools.clouderrorreporting.v1beta1.SourceLocation reportLocation_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocation,
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder,
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder>
        reportLocationBuilder_;
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught. This value is in contrast to `Exception.cause_location`,
     * which describes the source line where the exception was thrown.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public boolean hasReportLocation() {
      return reportLocationBuilder_ != null || reportLocation_ != null;
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught. This value is in contrast to `Exception.cause_location`,
     * which describes the source line where the exception was thrown.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.SourceLocation getReportLocation() {
      if (reportLocationBuilder_ == null) {
        return reportLocation_ == null
            ? com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.getDefaultInstance()
            : reportLocation_;
      } else {
        return reportLocationBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught. This value is in contrast to `Exception.cause_location`,
     * which describes the source line where the exception was thrown.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public Builder setReportLocation(
        com.google.devtools.clouderrorreporting.v1beta1.SourceLocation value) {
      if (reportLocationBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        reportLocation_ = value;
        onChanged();
      } else {
        reportLocationBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught. This value is in contrast to `Exception.cause_location`,
     * which describes the source line where the exception was thrown.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public Builder setReportLocation(
        com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder builderForValue) {
      if (reportLocationBuilder_ == null) {
        reportLocation_ = builderForValue.build();
        onChanged();
      } else {
        reportLocationBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught. This value is in contrast to `Exception.cause_location`,
     * which describes the source line where the exception was thrown.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public Builder mergeReportLocation(
        com.google.devtools.clouderrorreporting.v1beta1.SourceLocation value) {
      if (reportLocationBuilder_ == null) {
        if (reportLocation_ != null) {
          reportLocation_ =
              com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.newBuilder(
                      reportLocation_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          reportLocation_ = value;
        }
        onChanged();
      } else {
        reportLocationBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught. This value is in contrast to `Exception.cause_location`,
     * which describes the source line where the exception was thrown.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public Builder clearReportLocation() {
      if (reportLocationBuilder_ == null) {
        reportLocation_ = null;
        onChanged();
      } else {
        reportLocation_ = null;
        reportLocationBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught. This value is in contrast to `Exception.cause_location`,
     * which describes the source line where the exception was thrown.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder
        getReportLocationBuilder() {

      onChanged();
      return getReportLocationFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught. This value is in contrast to `Exception.cause_location`,
     * which describes the source line where the exception was thrown.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder
        getReportLocationOrBuilder() {
      if (reportLocationBuilder_ != null) {
        return reportLocationBuilder_.getMessageOrBuilder();
      } else {
        return reportLocation_ == null
            ? com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.getDefaultInstance()
            : reportLocation_;
      }
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught. This value is in contrast to `Exception.cause_location`,
     * which describes the source line where the exception was thrown.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocation,
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder,
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder>
        getReportLocationFieldBuilder() {
      if (reportLocationBuilder_ == null) {
        reportLocationBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.devtools.clouderrorreporting.v1beta1.SourceLocation,
                com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder,
                com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder>(
                getReportLocation(), getParentForChildren(), isClean());
        reportLocation_ = null;
      }
      return reportLocationBuilder_;
    }

    @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.devtools.clouderrorreporting.v1beta1.ErrorContext)
  }

  // @@protoc_insertion_point(class_scope:google.devtools.clouderrorreporting.v1beta1.ErrorContext)
  private static final com.google.devtools.clouderrorreporting.v1beta1.ErrorContext
      DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.devtools.clouderrorreporting.v1beta1.ErrorContext();
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.devtools.clouderrorreporting.v1beta1.ErrorContext getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
