// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/logging/v2/log_entry.proto

package com.google.logging.v2;

/**
 * <pre>
 * An individual entry in a log.
 * </pre>
 *
 * Protobuf type {@code google.logging.v2.LogEntry}
 */
public  final class LogEntry extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.logging.v2.LogEntry)
    LogEntryOrBuilder {
private static final long serialVersionUID = 0L;
  // Use LogEntry.newBuilder() to construct.
  private LogEntry(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private LogEntry() {
    logName_ = "";
    severity_ = 0;
    insertId_ = "";
    trace_ = "";
    spanId_ = "";
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private LogEntry(
      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;
          default: {
            if (!parseUnknownFieldProto3(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
          case 18: {
            com.google.protobuf.Any.Builder subBuilder = null;
            if (payloadCase_ == 2) {
              subBuilder = ((com.google.protobuf.Any) payload_).toBuilder();
            }
            payload_ =
                input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom((com.google.protobuf.Any) payload_);
              payload_ = subBuilder.buildPartial();
            }
            payloadCase_ = 2;
            break;
          }
          case 26: {
            java.lang.String s = input.readStringRequireUtf8();
            payloadCase_ = 3;
            payload_ = s;
            break;
          }
          case 34: {
            java.lang.String s = input.readStringRequireUtf8();

            insertId_ = s;
            break;
          }
          case 50: {
            com.google.protobuf.Struct.Builder subBuilder = null;
            if (payloadCase_ == 6) {
              subBuilder = ((com.google.protobuf.Struct) payload_).toBuilder();
            }
            payload_ =
                input.readMessage(com.google.protobuf.Struct.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom((com.google.protobuf.Struct) payload_);
              payload_ = subBuilder.buildPartial();
            }
            payloadCase_ = 6;
            break;
          }
          case 58: {
            com.google.logging.type.HttpRequest.Builder subBuilder = null;
            if (httpRequest_ != null) {
              subBuilder = httpRequest_.toBuilder();
            }
            httpRequest_ = input.readMessage(com.google.logging.type.HttpRequest.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(httpRequest_);
              httpRequest_ = subBuilder.buildPartial();
            }

            break;
          }
          case 66: {
            com.google.api.MonitoredResource.Builder subBuilder = null;
            if (resource_ != null) {
              subBuilder = resource_.toBuilder();
            }
            resource_ = input.readMessage(com.google.api.MonitoredResource.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(resource_);
              resource_ = subBuilder.buildPartial();
            }

            break;
          }
          case 74: {
            com.google.protobuf.Timestamp.Builder subBuilder = null;
            if (timestamp_ != null) {
              subBuilder = timestamp_.toBuilder();
            }
            timestamp_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(timestamp_);
              timestamp_ = subBuilder.buildPartial();
            }

            break;
          }
          case 80: {
            int rawValue = input.readEnum();

            severity_ = rawValue;
            break;
          }
          case 90: {
            if (!((mutable_bitField0_ & 0x00000400) == 0x00000400)) {
              labels_ = com.google.protobuf.MapField.newMapField(
                  LabelsDefaultEntryHolder.defaultEntry);
              mutable_bitField0_ |= 0x00000400;
            }
            com.google.protobuf.MapEntry<java.lang.String, java.lang.String>
            labels__ = input.readMessage(
                LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
            labels_.getMutableMap().put(
                labels__.getKey(), labels__.getValue());
            break;
          }
          case 98: {
            java.lang.String s = input.readStringRequireUtf8();

            logName_ = s;
            break;
          }
          case 122: {
            com.google.logging.v2.LogEntryOperation.Builder subBuilder = null;
            if (operation_ != null) {
              subBuilder = operation_.toBuilder();
            }
            operation_ = input.readMessage(com.google.logging.v2.LogEntryOperation.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(operation_);
              operation_ = subBuilder.buildPartial();
            }

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

            trace_ = s;
            break;
          }
          case 186: {
            com.google.logging.v2.LogEntrySourceLocation.Builder subBuilder = null;
            if (sourceLocation_ != null) {
              subBuilder = sourceLocation_.toBuilder();
            }
            sourceLocation_ = input.readMessage(com.google.logging.v2.LogEntrySourceLocation.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(sourceLocation_);
              sourceLocation_ = subBuilder.buildPartial();
            }

            break;
          }
          case 194: {
            com.google.protobuf.Timestamp.Builder subBuilder = null;
            if (receiveTimestamp_ != null) {
              subBuilder = receiveTimestamp_.toBuilder();
            }
            receiveTimestamp_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(receiveTimestamp_);
              receiveTimestamp_ = subBuilder.buildPartial();
            }

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

            spanId_ = s;
            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.logging.v2.LogEntryProto.internal_static_google_logging_v2_LogEntry_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  protected com.google.protobuf.MapField internalGetMapField(
      int number) {
    switch (number) {
      case 11:
        return internalGetLabels();
      default:
        throw new RuntimeException(
            "Invalid map field number: " + number);
    }
  }
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.logging.v2.LogEntryProto.internal_static_google_logging_v2_LogEntry_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.logging.v2.LogEntry.class, com.google.logging.v2.LogEntry.Builder.class);
  }

  private int bitField0_;
  private int payloadCase_ = 0;
  private java.lang.Object payload_;
  public enum PayloadCase
      implements com.google.protobuf.Internal.EnumLite {
    PROTO_PAYLOAD(2),
    TEXT_PAYLOAD(3),
    JSON_PAYLOAD(6),
    PAYLOAD_NOT_SET(0);
    private final int value;
    private PayloadCase(int value) {
      this.value = value;
    }
    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static PayloadCase valueOf(int value) {
      return forNumber(value);
    }

    public static PayloadCase forNumber(int value) {
      switch (value) {
        case 2: return PROTO_PAYLOAD;
        case 3: return TEXT_PAYLOAD;
        case 6: return JSON_PAYLOAD;
        case 0: return PAYLOAD_NOT_SET;
        default: return null;
      }
    }
    public int getNumber() {
      return this.value;
    }
  };

  public PayloadCase
  getPayloadCase() {
    return PayloadCase.forNumber(
        payloadCase_);
  }

  public static final int LOG_NAME_FIELD_NUMBER = 12;
  private volatile java.lang.Object logName_;
  /**
   * <pre>
   * Required. The resource name of the log to which this log entry belongs:
   *     "projects/[PROJECT_ID]/logs/[LOG_ID]"
   *     "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
   *     "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
   *     "folders/[FOLDER_ID]/logs/[LOG_ID]"
   *  A project number may optionally be used in place of PROJECT_ID. The
   *  project number is translated to its corresponding PROJECT_ID internally
   *  and the `log_name` field will contain PROJECT_ID in queries and exports.
   * `[LOG_ID]` must be URL-encoded within `log_name`. Example:
   * `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
   * `[LOG_ID]` must be less than 512 characters long and can only include the
   * following characters: upper and lower case alphanumeric characters,
   * forward-slash, underscore, hyphen, and period.
   * For backward compatibility, if `log_name` begins with a forward-slash, such
   * as `/projects/...`, then the log entry is ingested as usual but the
   * forward-slash is removed. Listing the log entry will not show the leading
   * slash and filtering for a log name with a leading slash will never return
   * any results.
   * </pre>
   *
   * <code>string log_name = 12;</code>
   */
  public java.lang.String getLogName() {
    java.lang.Object ref = logName_;
    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();
      logName_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Required. The resource name of the log to which this log entry belongs:
   *     "projects/[PROJECT_ID]/logs/[LOG_ID]"
   *     "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
   *     "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
   *     "folders/[FOLDER_ID]/logs/[LOG_ID]"
   *  A project number may optionally be used in place of PROJECT_ID. The
   *  project number is translated to its corresponding PROJECT_ID internally
   *  and the `log_name` field will contain PROJECT_ID in queries and exports.
   * `[LOG_ID]` must be URL-encoded within `log_name`. Example:
   * `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
   * `[LOG_ID]` must be less than 512 characters long and can only include the
   * following characters: upper and lower case alphanumeric characters,
   * forward-slash, underscore, hyphen, and period.
   * For backward compatibility, if `log_name` begins with a forward-slash, such
   * as `/projects/...`, then the log entry is ingested as usual but the
   * forward-slash is removed. Listing the log entry will not show the leading
   * slash and filtering for a log name with a leading slash will never return
   * any results.
   * </pre>
   *
   * <code>string log_name = 12;</code>
   */
  public com.google.protobuf.ByteString
      getLogNameBytes() {
    java.lang.Object ref = logName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      logName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int RESOURCE_FIELD_NUMBER = 8;
  private com.google.api.MonitoredResource resource_;
  /**
   * <pre>
   * Required. The monitored resource associated with this log entry.
   * Example: a log entry that reports a database error would be
   * associated with the monitored resource designating the particular
   * database that reported the error.
   * </pre>
   *
   * <code>.google.api.MonitoredResource resource = 8;</code>
   */
  public boolean hasResource() {
    return resource_ != null;
  }
  /**
   * <pre>
   * Required. The monitored resource associated with this log entry.
   * Example: a log entry that reports a database error would be
   * associated with the monitored resource designating the particular
   * database that reported the error.
   * </pre>
   *
   * <code>.google.api.MonitoredResource resource = 8;</code>
   */
  public com.google.api.MonitoredResource getResource() {
    return resource_ == null ? com.google.api.MonitoredResource.getDefaultInstance() : resource_;
  }
  /**
   * <pre>
   * Required. The monitored resource associated with this log entry.
   * Example: a log entry that reports a database error would be
   * associated with the monitored resource designating the particular
   * database that reported the error.
   * </pre>
   *
   * <code>.google.api.MonitoredResource resource = 8;</code>
   */
  public com.google.api.MonitoredResourceOrBuilder getResourceOrBuilder() {
    return getResource();
  }

  public static final int PROTO_PAYLOAD_FIELD_NUMBER = 2;
  /**
   * <pre>
   * The log entry payload, represented as a protocol buffer.  Some
   * Google Cloud Platform services use this field for their log
   * entry payloads.
   * </pre>
   *
   * <code>.google.protobuf.Any proto_payload = 2;</code>
   */
  public boolean hasProtoPayload() {
    return payloadCase_ == 2;
  }
  /**
   * <pre>
   * The log entry payload, represented as a protocol buffer.  Some
   * Google Cloud Platform services use this field for their log
   * entry payloads.
   * </pre>
   *
   * <code>.google.protobuf.Any proto_payload = 2;</code>
   */
  public com.google.protobuf.Any getProtoPayload() {
    if (payloadCase_ == 2) {
       return (com.google.protobuf.Any) payload_;
    }
    return com.google.protobuf.Any.getDefaultInstance();
  }
  /**
   * <pre>
   * The log entry payload, represented as a protocol buffer.  Some
   * Google Cloud Platform services use this field for their log
   * entry payloads.
   * </pre>
   *
   * <code>.google.protobuf.Any proto_payload = 2;</code>
   */
  public com.google.protobuf.AnyOrBuilder getProtoPayloadOrBuilder() {
    if (payloadCase_ == 2) {
       return (com.google.protobuf.Any) payload_;
    }
    return com.google.protobuf.Any.getDefaultInstance();
  }

  public static final int TEXT_PAYLOAD_FIELD_NUMBER = 3;
  /**
   * <pre>
   * The log entry payload, represented as a Unicode string (UTF-8).
   * </pre>
   *
   * <code>string text_payload = 3;</code>
   */
  public java.lang.String getTextPayload() {
    java.lang.Object ref = "";
    if (payloadCase_ == 3) {
      ref = payload_;
    }
    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();
      if (payloadCase_ == 3) {
        payload_ = s;
      }
      return s;
    }
  }
  /**
   * <pre>
   * The log entry payload, represented as a Unicode string (UTF-8).
   * </pre>
   *
   * <code>string text_payload = 3;</code>
   */
  public com.google.protobuf.ByteString
      getTextPayloadBytes() {
    java.lang.Object ref = "";
    if (payloadCase_ == 3) {
      ref = payload_;
    }
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      if (payloadCase_ == 3) {
        payload_ = b;
      }
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int JSON_PAYLOAD_FIELD_NUMBER = 6;
  /**
   * <pre>
   * The log entry payload, represented as a structure that is
   * expressed as a JSON object.
   * </pre>
   *
   * <code>.google.protobuf.Struct json_payload = 6;</code>
   */
  public boolean hasJsonPayload() {
    return payloadCase_ == 6;
  }
  /**
   * <pre>
   * The log entry payload, represented as a structure that is
   * expressed as a JSON object.
   * </pre>
   *
   * <code>.google.protobuf.Struct json_payload = 6;</code>
   */
  public com.google.protobuf.Struct getJsonPayload() {
    if (payloadCase_ == 6) {
       return (com.google.protobuf.Struct) payload_;
    }
    return com.google.protobuf.Struct.getDefaultInstance();
  }
  /**
   * <pre>
   * The log entry payload, represented as a structure that is
   * expressed as a JSON object.
   * </pre>
   *
   * <code>.google.protobuf.Struct json_payload = 6;</code>
   */
  public com.google.protobuf.StructOrBuilder getJsonPayloadOrBuilder() {
    if (payloadCase_ == 6) {
       return (com.google.protobuf.Struct) payload_;
    }
    return com.google.protobuf.Struct.getDefaultInstance();
  }

  public static final int TIMESTAMP_FIELD_NUMBER = 9;
  private com.google.protobuf.Timestamp timestamp_;
  /**
   * <pre>
   * Optional. The time the event described by the log entry occurred.
   * This time is used to compute the log entry's age and to enforce
   * the logs retention period. If this field is omitted in a new log
   * entry, then Stackdriver Logging assigns it the current time.
   * Incoming log entries should have timestamps that are no more than
   * the [logs retention period](/logging/quota-policy) in the past,
   * and no more than 24 hours in the future.
   * See the `entries.write` API method for more information.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp timestamp = 9;</code>
   */
  public boolean hasTimestamp() {
    return timestamp_ != null;
  }
  /**
   * <pre>
   * Optional. The time the event described by the log entry occurred.
   * This time is used to compute the log entry's age and to enforce
   * the logs retention period. If this field is omitted in a new log
   * entry, then Stackdriver Logging assigns it the current time.
   * Incoming log entries should have timestamps that are no more than
   * the [logs retention period](/logging/quota-policy) in the past,
   * and no more than 24 hours in the future.
   * See the `entries.write` API method for more information.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp timestamp = 9;</code>
   */
  public com.google.protobuf.Timestamp getTimestamp() {
    return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_;
  }
  /**
   * <pre>
   * Optional. The time the event described by the log entry occurred.
   * This time is used to compute the log entry's age and to enforce
   * the logs retention period. If this field is omitted in a new log
   * entry, then Stackdriver Logging assigns it the current time.
   * Incoming log entries should have timestamps that are no more than
   * the [logs retention period](/logging/quota-policy) in the past,
   * and no more than 24 hours in the future.
   * See the `entries.write` API method for more information.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp timestamp = 9;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() {
    return getTimestamp();
  }

  public static final int RECEIVE_TIMESTAMP_FIELD_NUMBER = 24;
  private com.google.protobuf.Timestamp receiveTimestamp_;
  /**
   * <pre>
   * Output only. The time the log entry was received by Stackdriver Logging.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
   */
  public boolean hasReceiveTimestamp() {
    return receiveTimestamp_ != null;
  }
  /**
   * <pre>
   * Output only. The time the log entry was received by Stackdriver Logging.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
   */
  public com.google.protobuf.Timestamp getReceiveTimestamp() {
    return receiveTimestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : receiveTimestamp_;
  }
  /**
   * <pre>
   * Output only. The time the log entry was received by Stackdriver Logging.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getReceiveTimestampOrBuilder() {
    return getReceiveTimestamp();
  }

  public static final int SEVERITY_FIELD_NUMBER = 10;
  private int severity_;
  /**
   * <pre>
   * Optional. The severity of the log entry. The default value is
   * `LogSeverity.DEFAULT`.
   * </pre>
   *
   * <code>.google.logging.type.LogSeverity severity = 10;</code>
   */
  public int getSeverityValue() {
    return severity_;
  }
  /**
   * <pre>
   * Optional. The severity of the log entry. The default value is
   * `LogSeverity.DEFAULT`.
   * </pre>
   *
   * <code>.google.logging.type.LogSeverity severity = 10;</code>
   */
  public com.google.logging.type.LogSeverity getSeverity() {
    com.google.logging.type.LogSeverity result = com.google.logging.type.LogSeverity.valueOf(severity_);
    return result == null ? com.google.logging.type.LogSeverity.UNRECOGNIZED : result;
  }

  public static final int INSERT_ID_FIELD_NUMBER = 4;
  private volatile java.lang.Object insertId_;
  /**
   * <pre>
   * Optional. A unique identifier for the log entry. If you provide a value,
   * then Stackdriver Logging considers other log entries in the same project,
   * with the same `timestamp`, and with the same `insert_id` to be duplicates
   * which can be removed.  If omitted in new log entries, then Stackdriver
   * Logging assigns its own unique identifier. The `insert_id` is also used
   * to order log entries that have the same `timestamp` value.
   * </pre>
   *
   * <code>string insert_id = 4;</code>
   */
  public java.lang.String getInsertId() {
    java.lang.Object ref = insertId_;
    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();
      insertId_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Optional. A unique identifier for the log entry. If you provide a value,
   * then Stackdriver Logging considers other log entries in the same project,
   * with the same `timestamp`, and with the same `insert_id` to be duplicates
   * which can be removed.  If omitted in new log entries, then Stackdriver
   * Logging assigns its own unique identifier. The `insert_id` is also used
   * to order log entries that have the same `timestamp` value.
   * </pre>
   *
   * <code>string insert_id = 4;</code>
   */
  public com.google.protobuf.ByteString
      getInsertIdBytes() {
    java.lang.Object ref = insertId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      insertId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int HTTP_REQUEST_FIELD_NUMBER = 7;
  private com.google.logging.type.HttpRequest httpRequest_;
  /**
   * <pre>
   * Optional. Information about the HTTP request associated with this
   * log entry, if applicable.
   * </pre>
   *
   * <code>.google.logging.type.HttpRequest http_request = 7;</code>
   */
  public boolean hasHttpRequest() {
    return httpRequest_ != null;
  }
  /**
   * <pre>
   * Optional. Information about the HTTP request associated with this
   * log entry, if applicable.
   * </pre>
   *
   * <code>.google.logging.type.HttpRequest http_request = 7;</code>
   */
  public com.google.logging.type.HttpRequest getHttpRequest() {
    return httpRequest_ == null ? com.google.logging.type.HttpRequest.getDefaultInstance() : httpRequest_;
  }
  /**
   * <pre>
   * Optional. Information about the HTTP request associated with this
   * log entry, if applicable.
   * </pre>
   *
   * <code>.google.logging.type.HttpRequest http_request = 7;</code>
   */
  public com.google.logging.type.HttpRequestOrBuilder getHttpRequestOrBuilder() {
    return getHttpRequest();
  }

  public static final int LABELS_FIELD_NUMBER = 11;
  private static final class LabelsDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<
        java.lang.String, java.lang.String> defaultEntry =
            com.google.protobuf.MapEntry
            .<java.lang.String, java.lang.String>newDefaultInstance(
                com.google.logging.v2.LogEntryProto.internal_static_google_logging_v2_LogEntry_LabelsEntry_descriptor, 
                com.google.protobuf.WireFormat.FieldType.STRING,
                "",
                com.google.protobuf.WireFormat.FieldType.STRING,
                "");
  }
  private com.google.protobuf.MapField<
      java.lang.String, java.lang.String> labels_;
  private com.google.protobuf.MapField<java.lang.String, java.lang.String>
  internalGetLabels() {
    if (labels_ == null) {
      return com.google.protobuf.MapField.emptyMapField(
          LabelsDefaultEntryHolder.defaultEntry);
    }
    return labels_;
  }

  public int getLabelsCount() {
    return internalGetLabels().getMap().size();
  }
  /**
   * <pre>
   * Optional. A set of user-defined (key, value) data that provides additional
   * information about the log entry.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 11;</code>
   */

  public boolean containsLabels(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    return internalGetLabels().getMap().containsKey(key);
  }
  /**
   * Use {@link #getLabelsMap()} instead.
   */
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getLabels() {
    return getLabelsMap();
  }
  /**
   * <pre>
   * Optional. A set of user-defined (key, value) data that provides additional
   * information about the log entry.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 11;</code>
   */

  public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
    return internalGetLabels().getMap();
  }
  /**
   * <pre>
   * Optional. A set of user-defined (key, value) data that provides additional
   * information about the log entry.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 11;</code>
   */

  public java.lang.String getLabelsOrDefault(
      java.lang.String key,
      java.lang.String defaultValue) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetLabels().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   * <pre>
   * Optional. A set of user-defined (key, value) data that provides additional
   * information about the log entry.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 11;</code>
   */

  public java.lang.String getLabelsOrThrow(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetLabels().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int OPERATION_FIELD_NUMBER = 15;
  private com.google.logging.v2.LogEntryOperation operation_;
  /**
   * <pre>
   * Optional. Information about an operation associated with the log entry, if
   * applicable.
   * </pre>
   *
   * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
   */
  public boolean hasOperation() {
    return operation_ != null;
  }
  /**
   * <pre>
   * Optional. Information about an operation associated with the log entry, if
   * applicable.
   * </pre>
   *
   * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
   */
  public com.google.logging.v2.LogEntryOperation getOperation() {
    return operation_ == null ? com.google.logging.v2.LogEntryOperation.getDefaultInstance() : operation_;
  }
  /**
   * <pre>
   * Optional. Information about an operation associated with the log entry, if
   * applicable.
   * </pre>
   *
   * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
   */
  public com.google.logging.v2.LogEntryOperationOrBuilder getOperationOrBuilder() {
    return getOperation();
  }

  public static final int TRACE_FIELD_NUMBER = 22;
  private volatile java.lang.Object trace_;
  /**
   * <pre>
   * Optional. Resource name of the trace associated with the log entry, if any.
   * If it contains a relative resource name, the name is assumed to be relative
   * to `//tracing.googleapis.com`. Example:
   * `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
   * </pre>
   *
   * <code>string trace = 22;</code>
   */
  public java.lang.String getTrace() {
    java.lang.Object ref = trace_;
    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();
      trace_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Optional. Resource name of the trace associated with the log entry, if any.
   * If it contains a relative resource name, the name is assumed to be relative
   * to `//tracing.googleapis.com`. Example:
   * `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
   * </pre>
   *
   * <code>string trace = 22;</code>
   */
  public com.google.protobuf.ByteString
      getTraceBytes() {
    java.lang.Object ref = trace_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      trace_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int SPAN_ID_FIELD_NUMBER = 27;
  private volatile java.lang.Object spanId_;
  /**
   * <pre>
   * Optional. Id of the span within the trace associated with the log entry.
   * e.g. "0000000000000042"
   * For Stackdriver trace spans, this is the same format that the Stackdriver
   * trace API uses.
   * The ID is a 16-character hexadecimal encoding of an 8-byte array.
   * </pre>
   *
   * <code>string span_id = 27;</code>
   */
  public java.lang.String getSpanId() {
    java.lang.Object ref = spanId_;
    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();
      spanId_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Optional. Id of the span within the trace associated with the log entry.
   * e.g. "0000000000000042"
   * For Stackdriver trace spans, this is the same format that the Stackdriver
   * trace API uses.
   * The ID is a 16-character hexadecimal encoding of an 8-byte array.
   * </pre>
   *
   * <code>string span_id = 27;</code>
   */
  public com.google.protobuf.ByteString
      getSpanIdBytes() {
    java.lang.Object ref = spanId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      spanId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int SOURCE_LOCATION_FIELD_NUMBER = 23;
  private com.google.logging.v2.LogEntrySourceLocation sourceLocation_;
  /**
   * <pre>
   * Optional. Source code location information associated with the log entry,
   * if any.
   * </pre>
   *
   * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
   */
  public boolean hasSourceLocation() {
    return sourceLocation_ != null;
  }
  /**
   * <pre>
   * Optional. Source code location information associated with the log entry,
   * if any.
   * </pre>
   *
   * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
   */
  public com.google.logging.v2.LogEntrySourceLocation getSourceLocation() {
    return sourceLocation_ == null ? com.google.logging.v2.LogEntrySourceLocation.getDefaultInstance() : sourceLocation_;
  }
  /**
   * <pre>
   * Optional. Source code location information associated with the log entry,
   * if any.
   * </pre>
   *
   * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
   */
  public com.google.logging.v2.LogEntrySourceLocationOrBuilder getSourceLocationOrBuilder() {
    return getSourceLocation();
  }

  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (payloadCase_ == 2) {
      output.writeMessage(2, (com.google.protobuf.Any) payload_);
    }
    if (payloadCase_ == 3) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, payload_);
    }
    if (!getInsertIdBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, insertId_);
    }
    if (payloadCase_ == 6) {
      output.writeMessage(6, (com.google.protobuf.Struct) payload_);
    }
    if (httpRequest_ != null) {
      output.writeMessage(7, getHttpRequest());
    }
    if (resource_ != null) {
      output.writeMessage(8, getResource());
    }
    if (timestamp_ != null) {
      output.writeMessage(9, getTimestamp());
    }
    if (severity_ != com.google.logging.type.LogSeverity.DEFAULT.getNumber()) {
      output.writeEnum(10, severity_);
    }
    com.google.protobuf.GeneratedMessageV3
      .serializeStringMapTo(
        output,
        internalGetLabels(),
        LabelsDefaultEntryHolder.defaultEntry,
        11);
    if (!getLogNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 12, logName_);
    }
    if (operation_ != null) {
      output.writeMessage(15, getOperation());
    }
    if (!getTraceBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 22, trace_);
    }
    if (sourceLocation_ != null) {
      output.writeMessage(23, getSourceLocation());
    }
    if (receiveTimestamp_ != null) {
      output.writeMessage(24, getReceiveTimestamp());
    }
    if (!getSpanIdBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 27, spanId_);
    }
    unknownFields.writeTo(output);
  }

  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (payloadCase_ == 2) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(2, (com.google.protobuf.Any) payload_);
    }
    if (payloadCase_ == 3) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, payload_);
    }
    if (!getInsertIdBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, insertId_);
    }
    if (payloadCase_ == 6) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(6, (com.google.protobuf.Struct) payload_);
    }
    if (httpRequest_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(7, getHttpRequest());
    }
    if (resource_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(8, getResource());
    }
    if (timestamp_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(9, getTimestamp());
    }
    if (severity_ != com.google.logging.type.LogSeverity.DEFAULT.getNumber()) {
      size += com.google.protobuf.CodedOutputStream
        .computeEnumSize(10, severity_);
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry
         : internalGetLabels().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String>
      labels__ = LabelsDefaultEntryHolder.defaultEntry.newBuilderForType()
          .setKey(entry.getKey())
          .setValue(entry.getValue())
          .build();
      size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(11, labels__);
    }
    if (!getLogNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, logName_);
    }
    if (operation_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(15, getOperation());
    }
    if (!getTraceBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(22, trace_);
    }
    if (sourceLocation_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(23, getSourceLocation());
    }
    if (receiveTimestamp_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(24, getReceiveTimestamp());
    }
    if (!getSpanIdBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(27, spanId_);
    }
    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.logging.v2.LogEntry)) {
      return super.equals(obj);
    }
    com.google.logging.v2.LogEntry other = (com.google.logging.v2.LogEntry) obj;

    boolean result = true;
    result = result && getLogName()
        .equals(other.getLogName());
    result = result && (hasResource() == other.hasResource());
    if (hasResource()) {
      result = result && getResource()
          .equals(other.getResource());
    }
    result = result && (hasTimestamp() == other.hasTimestamp());
    if (hasTimestamp()) {
      result = result && getTimestamp()
          .equals(other.getTimestamp());
    }
    result = result && (hasReceiveTimestamp() == other.hasReceiveTimestamp());
    if (hasReceiveTimestamp()) {
      result = result && getReceiveTimestamp()
          .equals(other.getReceiveTimestamp());
    }
    result = result && severity_ == other.severity_;
    result = result && getInsertId()
        .equals(other.getInsertId());
    result = result && (hasHttpRequest() == other.hasHttpRequest());
    if (hasHttpRequest()) {
      result = result && getHttpRequest()
          .equals(other.getHttpRequest());
    }
    result = result && internalGetLabels().equals(
        other.internalGetLabels());
    result = result && (hasOperation() == other.hasOperation());
    if (hasOperation()) {
      result = result && getOperation()
          .equals(other.getOperation());
    }
    result = result && getTrace()
        .equals(other.getTrace());
    result = result && getSpanId()
        .equals(other.getSpanId());
    result = result && (hasSourceLocation() == other.hasSourceLocation());
    if (hasSourceLocation()) {
      result = result && getSourceLocation()
          .equals(other.getSourceLocation());
    }
    result = result && getPayloadCase().equals(
        other.getPayloadCase());
    if (!result) return false;
    switch (payloadCase_) {
      case 2:
        result = result && getProtoPayload()
            .equals(other.getProtoPayload());
        break;
      case 3:
        result = result && getTextPayload()
            .equals(other.getTextPayload());
        break;
      case 6:
        result = result && getJsonPayload()
            .equals(other.getJsonPayload());
        break;
      case 0:
      default:
    }
    result = result && unknownFields.equals(other.unknownFields);
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + LOG_NAME_FIELD_NUMBER;
    hash = (53 * hash) + getLogName().hashCode();
    if (hasResource()) {
      hash = (37 * hash) + RESOURCE_FIELD_NUMBER;
      hash = (53 * hash) + getResource().hashCode();
    }
    if (hasTimestamp()) {
      hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER;
      hash = (53 * hash) + getTimestamp().hashCode();
    }
    if (hasReceiveTimestamp()) {
      hash = (37 * hash) + RECEIVE_TIMESTAMP_FIELD_NUMBER;
      hash = (53 * hash) + getReceiveTimestamp().hashCode();
    }
    hash = (37 * hash) + SEVERITY_FIELD_NUMBER;
    hash = (53 * hash) + severity_;
    hash = (37 * hash) + INSERT_ID_FIELD_NUMBER;
    hash = (53 * hash) + getInsertId().hashCode();
    if (hasHttpRequest()) {
      hash = (37 * hash) + HTTP_REQUEST_FIELD_NUMBER;
      hash = (53 * hash) + getHttpRequest().hashCode();
    }
    if (!internalGetLabels().getMap().isEmpty()) {
      hash = (37 * hash) + LABELS_FIELD_NUMBER;
      hash = (53 * hash) + internalGetLabels().hashCode();
    }
    if (hasOperation()) {
      hash = (37 * hash) + OPERATION_FIELD_NUMBER;
      hash = (53 * hash) + getOperation().hashCode();
    }
    hash = (37 * hash) + TRACE_FIELD_NUMBER;
    hash = (53 * hash) + getTrace().hashCode();
    hash = (37 * hash) + SPAN_ID_FIELD_NUMBER;
    hash = (53 * hash) + getSpanId().hashCode();
    if (hasSourceLocation()) {
      hash = (37 * hash) + SOURCE_LOCATION_FIELD_NUMBER;
      hash = (53 * hash) + getSourceLocation().hashCode();
    }
    switch (payloadCase_) {
      case 2:
        hash = (37 * hash) + PROTO_PAYLOAD_FIELD_NUMBER;
        hash = (53 * hash) + getProtoPayload().hashCode();
        break;
      case 3:
        hash = (37 * hash) + TEXT_PAYLOAD_FIELD_NUMBER;
        hash = (53 * hash) + getTextPayload().hashCode();
        break;
      case 6:
        hash = (37 * hash) + JSON_PAYLOAD_FIELD_NUMBER;
        hash = (53 * hash) + getJsonPayload().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.logging.v2.LogEntry parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.logging.v2.LogEntry parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.logging.v2.LogEntry parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.logging.v2.LogEntry 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.logging.v2.LogEntry parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.logging.v2.LogEntry parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.logging.v2.LogEntry parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.logging.v2.LogEntry 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.logging.v2.LogEntry parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.logging.v2.LogEntry 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.logging.v2.LogEntry parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.logging.v2.LogEntry parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.logging.v2.LogEntry prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  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>
   * An individual entry in a log.
   * </pre>
   *
   * Protobuf type {@code google.logging.v2.LogEntry}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.logging.v2.LogEntry)
      com.google.logging.v2.LogEntryOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.logging.v2.LogEntryProto.internal_static_google_logging_v2_LogEntry_descriptor;
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMapField(
        int number) {
      switch (number) {
        case 11:
          return internalGetLabels();
        default:
          throw new RuntimeException(
              "Invalid map field number: " + number);
      }
    }
    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMutableMapField(
        int number) {
      switch (number) {
        case 11:
          return internalGetMutableLabels();
        default:
          throw new RuntimeException(
              "Invalid map field number: " + number);
      }
    }
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.logging.v2.LogEntryProto.internal_static_google_logging_v2_LogEntry_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.logging.v2.LogEntry.class, com.google.logging.v2.LogEntry.Builder.class);
    }

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

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    public Builder clear() {
      super.clear();
      logName_ = "";

      if (resourceBuilder_ == null) {
        resource_ = null;
      } else {
        resource_ = null;
        resourceBuilder_ = null;
      }
      if (timestampBuilder_ == null) {
        timestamp_ = null;
      } else {
        timestamp_ = null;
        timestampBuilder_ = null;
      }
      if (receiveTimestampBuilder_ == null) {
        receiveTimestamp_ = null;
      } else {
        receiveTimestamp_ = null;
        receiveTimestampBuilder_ = null;
      }
      severity_ = 0;

      insertId_ = "";

      if (httpRequestBuilder_ == null) {
        httpRequest_ = null;
      } else {
        httpRequest_ = null;
        httpRequestBuilder_ = null;
      }
      internalGetMutableLabels().clear();
      if (operationBuilder_ == null) {
        operation_ = null;
      } else {
        operation_ = null;
        operationBuilder_ = null;
      }
      trace_ = "";

      spanId_ = "";

      if (sourceLocationBuilder_ == null) {
        sourceLocation_ = null;
      } else {
        sourceLocation_ = null;
        sourceLocationBuilder_ = null;
      }
      payloadCase_ = 0;
      payload_ = null;
      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.logging.v2.LogEntryProto.internal_static_google_logging_v2_LogEntry_descriptor;
    }

    public com.google.logging.v2.LogEntry getDefaultInstanceForType() {
      return com.google.logging.v2.LogEntry.getDefaultInstance();
    }

    public com.google.logging.v2.LogEntry build() {
      com.google.logging.v2.LogEntry result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.google.logging.v2.LogEntry buildPartial() {
      com.google.logging.v2.LogEntry result = new com.google.logging.v2.LogEntry(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.logName_ = logName_;
      if (resourceBuilder_ == null) {
        result.resource_ = resource_;
      } else {
        result.resource_ = resourceBuilder_.build();
      }
      if (payloadCase_ == 2) {
        if (protoPayloadBuilder_ == null) {
          result.payload_ = payload_;
        } else {
          result.payload_ = protoPayloadBuilder_.build();
        }
      }
      if (payloadCase_ == 3) {
        result.payload_ = payload_;
      }
      if (payloadCase_ == 6) {
        if (jsonPayloadBuilder_ == null) {
          result.payload_ = payload_;
        } else {
          result.payload_ = jsonPayloadBuilder_.build();
        }
      }
      if (timestampBuilder_ == null) {
        result.timestamp_ = timestamp_;
      } else {
        result.timestamp_ = timestampBuilder_.build();
      }
      if (receiveTimestampBuilder_ == null) {
        result.receiveTimestamp_ = receiveTimestamp_;
      } else {
        result.receiveTimestamp_ = receiveTimestampBuilder_.build();
      }
      result.severity_ = severity_;
      result.insertId_ = insertId_;
      if (httpRequestBuilder_ == null) {
        result.httpRequest_ = httpRequest_;
      } else {
        result.httpRequest_ = httpRequestBuilder_.build();
      }
      result.labels_ = internalGetLabels();
      result.labels_.makeImmutable();
      if (operationBuilder_ == null) {
        result.operation_ = operation_;
      } else {
        result.operation_ = operationBuilder_.build();
      }
      result.trace_ = trace_;
      result.spanId_ = spanId_;
      if (sourceLocationBuilder_ == null) {
        result.sourceLocation_ = sourceLocation_;
      } else {
        result.sourceLocation_ = sourceLocationBuilder_.build();
      }
      result.bitField0_ = to_bitField0_;
      result.payloadCase_ = payloadCase_;
      onBuilt();
      return result;
    }

    public Builder clone() {
      return (Builder) super.clone();
    }
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.setField(field, value);
    }
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.logging.v2.LogEntry) {
        return mergeFrom((com.google.logging.v2.LogEntry)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.logging.v2.LogEntry other) {
      if (other == com.google.logging.v2.LogEntry.getDefaultInstance()) return this;
      if (!other.getLogName().isEmpty()) {
        logName_ = other.logName_;
        onChanged();
      }
      if (other.hasResource()) {
        mergeResource(other.getResource());
      }
      if (other.hasTimestamp()) {
        mergeTimestamp(other.getTimestamp());
      }
      if (other.hasReceiveTimestamp()) {
        mergeReceiveTimestamp(other.getReceiveTimestamp());
      }
      if (other.severity_ != 0) {
        setSeverityValue(other.getSeverityValue());
      }
      if (!other.getInsertId().isEmpty()) {
        insertId_ = other.insertId_;
        onChanged();
      }
      if (other.hasHttpRequest()) {
        mergeHttpRequest(other.getHttpRequest());
      }
      internalGetMutableLabels().mergeFrom(
          other.internalGetLabels());
      if (other.hasOperation()) {
        mergeOperation(other.getOperation());
      }
      if (!other.getTrace().isEmpty()) {
        trace_ = other.trace_;
        onChanged();
      }
      if (!other.getSpanId().isEmpty()) {
        spanId_ = other.spanId_;
        onChanged();
      }
      if (other.hasSourceLocation()) {
        mergeSourceLocation(other.getSourceLocation());
      }
      switch (other.getPayloadCase()) {
        case PROTO_PAYLOAD: {
          mergeProtoPayload(other.getProtoPayload());
          break;
        }
        case TEXT_PAYLOAD: {
          payloadCase_ = 3;
          payload_ = other.payload_;
          onChanged();
          break;
        }
        case JSON_PAYLOAD: {
          mergeJsonPayload(other.getJsonPayload());
          break;
        }
        case PAYLOAD_NOT_SET: {
          break;
        }
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.logging.v2.LogEntry parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.logging.v2.LogEntry) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int payloadCase_ = 0;
    private java.lang.Object payload_;
    public PayloadCase
        getPayloadCase() {
      return PayloadCase.forNumber(
          payloadCase_);
    }

    public Builder clearPayload() {
      payloadCase_ = 0;
      payload_ = null;
      onChanged();
      return this;
    }

    private int bitField0_;

    private java.lang.Object logName_ = "";
    /**
     * <pre>
     * Required. The resource name of the log to which this log entry belongs:
     *     "projects/[PROJECT_ID]/logs/[LOG_ID]"
     *     "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
     *     "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
     *     "folders/[FOLDER_ID]/logs/[LOG_ID]"
     *  A project number may optionally be used in place of PROJECT_ID. The
     *  project number is translated to its corresponding PROJECT_ID internally
     *  and the `log_name` field will contain PROJECT_ID in queries and exports.
     * `[LOG_ID]` must be URL-encoded within `log_name`. Example:
     * `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
     * `[LOG_ID]` must be less than 512 characters long and can only include the
     * following characters: upper and lower case alphanumeric characters,
     * forward-slash, underscore, hyphen, and period.
     * For backward compatibility, if `log_name` begins with a forward-slash, such
     * as `/projects/...`, then the log entry is ingested as usual but the
     * forward-slash is removed. Listing the log entry will not show the leading
     * slash and filtering for a log name with a leading slash will never return
     * any results.
     * </pre>
     *
     * <code>string log_name = 12;</code>
     */
    public java.lang.String getLogName() {
      java.lang.Object ref = logName_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        logName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Required. The resource name of the log to which this log entry belongs:
     *     "projects/[PROJECT_ID]/logs/[LOG_ID]"
     *     "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
     *     "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
     *     "folders/[FOLDER_ID]/logs/[LOG_ID]"
     *  A project number may optionally be used in place of PROJECT_ID. The
     *  project number is translated to its corresponding PROJECT_ID internally
     *  and the `log_name` field will contain PROJECT_ID in queries and exports.
     * `[LOG_ID]` must be URL-encoded within `log_name`. Example:
     * `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
     * `[LOG_ID]` must be less than 512 characters long and can only include the
     * following characters: upper and lower case alphanumeric characters,
     * forward-slash, underscore, hyphen, and period.
     * For backward compatibility, if `log_name` begins with a forward-slash, such
     * as `/projects/...`, then the log entry is ingested as usual but the
     * forward-slash is removed. Listing the log entry will not show the leading
     * slash and filtering for a log name with a leading slash will never return
     * any results.
     * </pre>
     *
     * <code>string log_name = 12;</code>
     */
    public com.google.protobuf.ByteString
        getLogNameBytes() {
      java.lang.Object ref = logName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        logName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Required. The resource name of the log to which this log entry belongs:
     *     "projects/[PROJECT_ID]/logs/[LOG_ID]"
     *     "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
     *     "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
     *     "folders/[FOLDER_ID]/logs/[LOG_ID]"
     *  A project number may optionally be used in place of PROJECT_ID. The
     *  project number is translated to its corresponding PROJECT_ID internally
     *  and the `log_name` field will contain PROJECT_ID in queries and exports.
     * `[LOG_ID]` must be URL-encoded within `log_name`. Example:
     * `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
     * `[LOG_ID]` must be less than 512 characters long and can only include the
     * following characters: upper and lower case alphanumeric characters,
     * forward-slash, underscore, hyphen, and period.
     * For backward compatibility, if `log_name` begins with a forward-slash, such
     * as `/projects/...`, then the log entry is ingested as usual but the
     * forward-slash is removed. Listing the log entry will not show the leading
     * slash and filtering for a log name with a leading slash will never return
     * any results.
     * </pre>
     *
     * <code>string log_name = 12;</code>
     */
    public Builder setLogName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      logName_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The resource name of the log to which this log entry belongs:
     *     "projects/[PROJECT_ID]/logs/[LOG_ID]"
     *     "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
     *     "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
     *     "folders/[FOLDER_ID]/logs/[LOG_ID]"
     *  A project number may optionally be used in place of PROJECT_ID. The
     *  project number is translated to its corresponding PROJECT_ID internally
     *  and the `log_name` field will contain PROJECT_ID in queries and exports.
     * `[LOG_ID]` must be URL-encoded within `log_name`. Example:
     * `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
     * `[LOG_ID]` must be less than 512 characters long and can only include the
     * following characters: upper and lower case alphanumeric characters,
     * forward-slash, underscore, hyphen, and period.
     * For backward compatibility, if `log_name` begins with a forward-slash, such
     * as `/projects/...`, then the log entry is ingested as usual but the
     * forward-slash is removed. Listing the log entry will not show the leading
     * slash and filtering for a log name with a leading slash will never return
     * any results.
     * </pre>
     *
     * <code>string log_name = 12;</code>
     */
    public Builder clearLogName() {
      
      logName_ = getDefaultInstance().getLogName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The resource name of the log to which this log entry belongs:
     *     "projects/[PROJECT_ID]/logs/[LOG_ID]"
     *     "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
     *     "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
     *     "folders/[FOLDER_ID]/logs/[LOG_ID]"
     *  A project number may optionally be used in place of PROJECT_ID. The
     *  project number is translated to its corresponding PROJECT_ID internally
     *  and the `log_name` field will contain PROJECT_ID in queries and exports.
     * `[LOG_ID]` must be URL-encoded within `log_name`. Example:
     * `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
     * `[LOG_ID]` must be less than 512 characters long and can only include the
     * following characters: upper and lower case alphanumeric characters,
     * forward-slash, underscore, hyphen, and period.
     * For backward compatibility, if `log_name` begins with a forward-slash, such
     * as `/projects/...`, then the log entry is ingested as usual but the
     * forward-slash is removed. Listing the log entry will not show the leading
     * slash and filtering for a log name with a leading slash will never return
     * any results.
     * </pre>
     *
     * <code>string log_name = 12;</code>
     */
    public Builder setLogNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      logName_ = value;
      onChanged();
      return this;
    }

    private com.google.api.MonitoredResource resource_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.api.MonitoredResource, com.google.api.MonitoredResource.Builder, com.google.api.MonitoredResourceOrBuilder> resourceBuilder_;
    /**
     * <pre>
     * Required. The monitored resource associated with this log entry.
     * Example: a log entry that reports a database error would be
     * associated with the monitored resource designating the particular
     * database that reported the error.
     * </pre>
     *
     * <code>.google.api.MonitoredResource resource = 8;</code>
     */
    public boolean hasResource() {
      return resourceBuilder_ != null || resource_ != null;
    }
    /**
     * <pre>
     * Required. The monitored resource associated with this log entry.
     * Example: a log entry that reports a database error would be
     * associated with the monitored resource designating the particular
     * database that reported the error.
     * </pre>
     *
     * <code>.google.api.MonitoredResource resource = 8;</code>
     */
    public com.google.api.MonitoredResource getResource() {
      if (resourceBuilder_ == null) {
        return resource_ == null ? com.google.api.MonitoredResource.getDefaultInstance() : resource_;
      } else {
        return resourceBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Required. The monitored resource associated with this log entry.
     * Example: a log entry that reports a database error would be
     * associated with the monitored resource designating the particular
     * database that reported the error.
     * </pre>
     *
     * <code>.google.api.MonitoredResource resource = 8;</code>
     */
    public Builder setResource(com.google.api.MonitoredResource value) {
      if (resourceBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        resource_ = value;
        onChanged();
      } else {
        resourceBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Required. The monitored resource associated with this log entry.
     * Example: a log entry that reports a database error would be
     * associated with the monitored resource designating the particular
     * database that reported the error.
     * </pre>
     *
     * <code>.google.api.MonitoredResource resource = 8;</code>
     */
    public Builder setResource(
        com.google.api.MonitoredResource.Builder builderForValue) {
      if (resourceBuilder_ == null) {
        resource_ = builderForValue.build();
        onChanged();
      } else {
        resourceBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Required. The monitored resource associated with this log entry.
     * Example: a log entry that reports a database error would be
     * associated with the monitored resource designating the particular
     * database that reported the error.
     * </pre>
     *
     * <code>.google.api.MonitoredResource resource = 8;</code>
     */
    public Builder mergeResource(com.google.api.MonitoredResource value) {
      if (resourceBuilder_ == null) {
        if (resource_ != null) {
          resource_ =
            com.google.api.MonitoredResource.newBuilder(resource_).mergeFrom(value).buildPartial();
        } else {
          resource_ = value;
        }
        onChanged();
      } else {
        resourceBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Required. The monitored resource associated with this log entry.
     * Example: a log entry that reports a database error would be
     * associated with the monitored resource designating the particular
     * database that reported the error.
     * </pre>
     *
     * <code>.google.api.MonitoredResource resource = 8;</code>
     */
    public Builder clearResource() {
      if (resourceBuilder_ == null) {
        resource_ = null;
        onChanged();
      } else {
        resource_ = null;
        resourceBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Required. The monitored resource associated with this log entry.
     * Example: a log entry that reports a database error would be
     * associated with the monitored resource designating the particular
     * database that reported the error.
     * </pre>
     *
     * <code>.google.api.MonitoredResource resource = 8;</code>
     */
    public com.google.api.MonitoredResource.Builder getResourceBuilder() {
      
      onChanged();
      return getResourceFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Required. The monitored resource associated with this log entry.
     * Example: a log entry that reports a database error would be
     * associated with the monitored resource designating the particular
     * database that reported the error.
     * </pre>
     *
     * <code>.google.api.MonitoredResource resource = 8;</code>
     */
    public com.google.api.MonitoredResourceOrBuilder getResourceOrBuilder() {
      if (resourceBuilder_ != null) {
        return resourceBuilder_.getMessageOrBuilder();
      } else {
        return resource_ == null ?
            com.google.api.MonitoredResource.getDefaultInstance() : resource_;
      }
    }
    /**
     * <pre>
     * Required. The monitored resource associated with this log entry.
     * Example: a log entry that reports a database error would be
     * associated with the monitored resource designating the particular
     * database that reported the error.
     * </pre>
     *
     * <code>.google.api.MonitoredResource resource = 8;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.api.MonitoredResource, com.google.api.MonitoredResource.Builder, com.google.api.MonitoredResourceOrBuilder> 
        getResourceFieldBuilder() {
      if (resourceBuilder_ == null) {
        resourceBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.api.MonitoredResource, com.google.api.MonitoredResource.Builder, com.google.api.MonitoredResourceOrBuilder>(
                getResource(),
                getParentForChildren(),
                isClean());
        resource_ = null;
      }
      return resourceBuilder_;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> protoPayloadBuilder_;
    /**
     * <pre>
     * The log entry payload, represented as a protocol buffer.  Some
     * Google Cloud Platform services use this field for their log
     * entry payloads.
     * </pre>
     *
     * <code>.google.protobuf.Any proto_payload = 2;</code>
     */
    public boolean hasProtoPayload() {
      return payloadCase_ == 2;
    }
    /**
     * <pre>
     * The log entry payload, represented as a protocol buffer.  Some
     * Google Cloud Platform services use this field for their log
     * entry payloads.
     * </pre>
     *
     * <code>.google.protobuf.Any proto_payload = 2;</code>
     */
    public com.google.protobuf.Any getProtoPayload() {
      if (protoPayloadBuilder_ == null) {
        if (payloadCase_ == 2) {
          return (com.google.protobuf.Any) payload_;
        }
        return com.google.protobuf.Any.getDefaultInstance();
      } else {
        if (payloadCase_ == 2) {
          return protoPayloadBuilder_.getMessage();
        }
        return com.google.protobuf.Any.getDefaultInstance();
      }
    }
    /**
     * <pre>
     * The log entry payload, represented as a protocol buffer.  Some
     * Google Cloud Platform services use this field for their log
     * entry payloads.
     * </pre>
     *
     * <code>.google.protobuf.Any proto_payload = 2;</code>
     */
    public Builder setProtoPayload(com.google.protobuf.Any value) {
      if (protoPayloadBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        payload_ = value;
        onChanged();
      } else {
        protoPayloadBuilder_.setMessage(value);
      }
      payloadCase_ = 2;
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a protocol buffer.  Some
     * Google Cloud Platform services use this field for their log
     * entry payloads.
     * </pre>
     *
     * <code>.google.protobuf.Any proto_payload = 2;</code>
     */
    public Builder setProtoPayload(
        com.google.protobuf.Any.Builder builderForValue) {
      if (protoPayloadBuilder_ == null) {
        payload_ = builderForValue.build();
        onChanged();
      } else {
        protoPayloadBuilder_.setMessage(builderForValue.build());
      }
      payloadCase_ = 2;
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a protocol buffer.  Some
     * Google Cloud Platform services use this field for their log
     * entry payloads.
     * </pre>
     *
     * <code>.google.protobuf.Any proto_payload = 2;</code>
     */
    public Builder mergeProtoPayload(com.google.protobuf.Any value) {
      if (protoPayloadBuilder_ == null) {
        if (payloadCase_ == 2 &&
            payload_ != com.google.protobuf.Any.getDefaultInstance()) {
          payload_ = com.google.protobuf.Any.newBuilder((com.google.protobuf.Any) payload_)
              .mergeFrom(value).buildPartial();
        } else {
          payload_ = value;
        }
        onChanged();
      } else {
        if (payloadCase_ == 2) {
          protoPayloadBuilder_.mergeFrom(value);
        }
        protoPayloadBuilder_.setMessage(value);
      }
      payloadCase_ = 2;
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a protocol buffer.  Some
     * Google Cloud Platform services use this field for their log
     * entry payloads.
     * </pre>
     *
     * <code>.google.protobuf.Any proto_payload = 2;</code>
     */
    public Builder clearProtoPayload() {
      if (protoPayloadBuilder_ == null) {
        if (payloadCase_ == 2) {
          payloadCase_ = 0;
          payload_ = null;
          onChanged();
        }
      } else {
        if (payloadCase_ == 2) {
          payloadCase_ = 0;
          payload_ = null;
        }
        protoPayloadBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a protocol buffer.  Some
     * Google Cloud Platform services use this field for their log
     * entry payloads.
     * </pre>
     *
     * <code>.google.protobuf.Any proto_payload = 2;</code>
     */
    public com.google.protobuf.Any.Builder getProtoPayloadBuilder() {
      return getProtoPayloadFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The log entry payload, represented as a protocol buffer.  Some
     * Google Cloud Platform services use this field for their log
     * entry payloads.
     * </pre>
     *
     * <code>.google.protobuf.Any proto_payload = 2;</code>
     */
    public com.google.protobuf.AnyOrBuilder getProtoPayloadOrBuilder() {
      if ((payloadCase_ == 2) && (protoPayloadBuilder_ != null)) {
        return protoPayloadBuilder_.getMessageOrBuilder();
      } else {
        if (payloadCase_ == 2) {
          return (com.google.protobuf.Any) payload_;
        }
        return com.google.protobuf.Any.getDefaultInstance();
      }
    }
    /**
     * <pre>
     * The log entry payload, represented as a protocol buffer.  Some
     * Google Cloud Platform services use this field for their log
     * entry payloads.
     * </pre>
     *
     * <code>.google.protobuf.Any proto_payload = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> 
        getProtoPayloadFieldBuilder() {
      if (protoPayloadBuilder_ == null) {
        if (!(payloadCase_ == 2)) {
          payload_ = com.google.protobuf.Any.getDefaultInstance();
        }
        protoPayloadBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>(
                (com.google.protobuf.Any) payload_,
                getParentForChildren(),
                isClean());
        payload_ = null;
      }
      payloadCase_ = 2;
      onChanged();;
      return protoPayloadBuilder_;
    }

    /**
     * <pre>
     * The log entry payload, represented as a Unicode string (UTF-8).
     * </pre>
     *
     * <code>string text_payload = 3;</code>
     */
    public java.lang.String getTextPayload() {
      java.lang.Object ref = "";
      if (payloadCase_ == 3) {
        ref = payload_;
      }
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (payloadCase_ == 3) {
          payload_ = s;
        }
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The log entry payload, represented as a Unicode string (UTF-8).
     * </pre>
     *
     * <code>string text_payload = 3;</code>
     */
    public com.google.protobuf.ByteString
        getTextPayloadBytes() {
      java.lang.Object ref = "";
      if (payloadCase_ == 3) {
        ref = payload_;
      }
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        if (payloadCase_ == 3) {
          payload_ = b;
        }
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The log entry payload, represented as a Unicode string (UTF-8).
     * </pre>
     *
     * <code>string text_payload = 3;</code>
     */
    public Builder setTextPayload(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  payloadCase_ = 3;
      payload_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a Unicode string (UTF-8).
     * </pre>
     *
     * <code>string text_payload = 3;</code>
     */
    public Builder clearTextPayload() {
      if (payloadCase_ == 3) {
        payloadCase_ = 0;
        payload_ = null;
        onChanged();
      }
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a Unicode string (UTF-8).
     * </pre>
     *
     * <code>string text_payload = 3;</code>
     */
    public Builder setTextPayloadBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      payloadCase_ = 3;
      payload_ = value;
      onChanged();
      return this;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> jsonPayloadBuilder_;
    /**
     * <pre>
     * The log entry payload, represented as a structure that is
     * expressed as a JSON object.
     * </pre>
     *
     * <code>.google.protobuf.Struct json_payload = 6;</code>
     */
    public boolean hasJsonPayload() {
      return payloadCase_ == 6;
    }
    /**
     * <pre>
     * The log entry payload, represented as a structure that is
     * expressed as a JSON object.
     * </pre>
     *
     * <code>.google.protobuf.Struct json_payload = 6;</code>
     */
    public com.google.protobuf.Struct getJsonPayload() {
      if (jsonPayloadBuilder_ == null) {
        if (payloadCase_ == 6) {
          return (com.google.protobuf.Struct) payload_;
        }
        return com.google.protobuf.Struct.getDefaultInstance();
      } else {
        if (payloadCase_ == 6) {
          return jsonPayloadBuilder_.getMessage();
        }
        return com.google.protobuf.Struct.getDefaultInstance();
      }
    }
    /**
     * <pre>
     * The log entry payload, represented as a structure that is
     * expressed as a JSON object.
     * </pre>
     *
     * <code>.google.protobuf.Struct json_payload = 6;</code>
     */
    public Builder setJsonPayload(com.google.protobuf.Struct value) {
      if (jsonPayloadBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        payload_ = value;
        onChanged();
      } else {
        jsonPayloadBuilder_.setMessage(value);
      }
      payloadCase_ = 6;
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a structure that is
     * expressed as a JSON object.
     * </pre>
     *
     * <code>.google.protobuf.Struct json_payload = 6;</code>
     */
    public Builder setJsonPayload(
        com.google.protobuf.Struct.Builder builderForValue) {
      if (jsonPayloadBuilder_ == null) {
        payload_ = builderForValue.build();
        onChanged();
      } else {
        jsonPayloadBuilder_.setMessage(builderForValue.build());
      }
      payloadCase_ = 6;
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a structure that is
     * expressed as a JSON object.
     * </pre>
     *
     * <code>.google.protobuf.Struct json_payload = 6;</code>
     */
    public Builder mergeJsonPayload(com.google.protobuf.Struct value) {
      if (jsonPayloadBuilder_ == null) {
        if (payloadCase_ == 6 &&
            payload_ != com.google.protobuf.Struct.getDefaultInstance()) {
          payload_ = com.google.protobuf.Struct.newBuilder((com.google.protobuf.Struct) payload_)
              .mergeFrom(value).buildPartial();
        } else {
          payload_ = value;
        }
        onChanged();
      } else {
        if (payloadCase_ == 6) {
          jsonPayloadBuilder_.mergeFrom(value);
        }
        jsonPayloadBuilder_.setMessage(value);
      }
      payloadCase_ = 6;
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a structure that is
     * expressed as a JSON object.
     * </pre>
     *
     * <code>.google.protobuf.Struct json_payload = 6;</code>
     */
    public Builder clearJsonPayload() {
      if (jsonPayloadBuilder_ == null) {
        if (payloadCase_ == 6) {
          payloadCase_ = 0;
          payload_ = null;
          onChanged();
        }
      } else {
        if (payloadCase_ == 6) {
          payloadCase_ = 0;
          payload_ = null;
        }
        jsonPayloadBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * The log entry payload, represented as a structure that is
     * expressed as a JSON object.
     * </pre>
     *
     * <code>.google.protobuf.Struct json_payload = 6;</code>
     */
    public com.google.protobuf.Struct.Builder getJsonPayloadBuilder() {
      return getJsonPayloadFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The log entry payload, represented as a structure that is
     * expressed as a JSON object.
     * </pre>
     *
     * <code>.google.protobuf.Struct json_payload = 6;</code>
     */
    public com.google.protobuf.StructOrBuilder getJsonPayloadOrBuilder() {
      if ((payloadCase_ == 6) && (jsonPayloadBuilder_ != null)) {
        return jsonPayloadBuilder_.getMessageOrBuilder();
      } else {
        if (payloadCase_ == 6) {
          return (com.google.protobuf.Struct) payload_;
        }
        return com.google.protobuf.Struct.getDefaultInstance();
      }
    }
    /**
     * <pre>
     * The log entry payload, represented as a structure that is
     * expressed as a JSON object.
     * </pre>
     *
     * <code>.google.protobuf.Struct json_payload = 6;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> 
        getJsonPayloadFieldBuilder() {
      if (jsonPayloadBuilder_ == null) {
        if (!(payloadCase_ == 6)) {
          payload_ = com.google.protobuf.Struct.getDefaultInstance();
        }
        jsonPayloadBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>(
                (com.google.protobuf.Struct) payload_,
                getParentForChildren(),
                isClean());
        payload_ = null;
      }
      payloadCase_ = 6;
      onChanged();;
      return jsonPayloadBuilder_;
    }

    private com.google.protobuf.Timestamp timestamp_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> timestampBuilder_;
    /**
     * <pre>
     * Optional. The time the event described by the log entry occurred.
     * This time is used to compute the log entry's age and to enforce
     * the logs retention period. If this field is omitted in a new log
     * entry, then Stackdriver Logging assigns it the current time.
     * Incoming log entries should have timestamps that are no more than
     * the [logs retention period](/logging/quota-policy) in the past,
     * and no more than 24 hours in the future.
     * See the `entries.write` API method for more information.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp timestamp = 9;</code>
     */
    public boolean hasTimestamp() {
      return timestampBuilder_ != null || timestamp_ != null;
    }
    /**
     * <pre>
     * Optional. The time the event described by the log entry occurred.
     * This time is used to compute the log entry's age and to enforce
     * the logs retention period. If this field is omitted in a new log
     * entry, then Stackdriver Logging assigns it the current time.
     * Incoming log entries should have timestamps that are no more than
     * the [logs retention period](/logging/quota-policy) in the past,
     * and no more than 24 hours in the future.
     * See the `entries.write` API method for more information.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp timestamp = 9;</code>
     */
    public com.google.protobuf.Timestamp getTimestamp() {
      if (timestampBuilder_ == null) {
        return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_;
      } else {
        return timestampBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Optional. The time the event described by the log entry occurred.
     * This time is used to compute the log entry's age and to enforce
     * the logs retention period. If this field is omitted in a new log
     * entry, then Stackdriver Logging assigns it the current time.
     * Incoming log entries should have timestamps that are no more than
     * the [logs retention period](/logging/quota-policy) in the past,
     * and no more than 24 hours in the future.
     * See the `entries.write` API method for more information.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp timestamp = 9;</code>
     */
    public Builder setTimestamp(com.google.protobuf.Timestamp value) {
      if (timestampBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        timestamp_ = value;
        onChanged();
      } else {
        timestampBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. The time the event described by the log entry occurred.
     * This time is used to compute the log entry's age and to enforce
     * the logs retention period. If this field is omitted in a new log
     * entry, then Stackdriver Logging assigns it the current time.
     * Incoming log entries should have timestamps that are no more than
     * the [logs retention period](/logging/quota-policy) in the past,
     * and no more than 24 hours in the future.
     * See the `entries.write` API method for more information.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp timestamp = 9;</code>
     */
    public Builder setTimestamp(
        com.google.protobuf.Timestamp.Builder builderForValue) {
      if (timestampBuilder_ == null) {
        timestamp_ = builderForValue.build();
        onChanged();
      } else {
        timestampBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Optional. The time the event described by the log entry occurred.
     * This time is used to compute the log entry's age and to enforce
     * the logs retention period. If this field is omitted in a new log
     * entry, then Stackdriver Logging assigns it the current time.
     * Incoming log entries should have timestamps that are no more than
     * the [logs retention period](/logging/quota-policy) in the past,
     * and no more than 24 hours in the future.
     * See the `entries.write` API method for more information.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp timestamp = 9;</code>
     */
    public Builder mergeTimestamp(com.google.protobuf.Timestamp value) {
      if (timestampBuilder_ == null) {
        if (timestamp_ != null) {
          timestamp_ =
            com.google.protobuf.Timestamp.newBuilder(timestamp_).mergeFrom(value).buildPartial();
        } else {
          timestamp_ = value;
        }
        onChanged();
      } else {
        timestampBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. The time the event described by the log entry occurred.
     * This time is used to compute the log entry's age and to enforce
     * the logs retention period. If this field is omitted in a new log
     * entry, then Stackdriver Logging assigns it the current time.
     * Incoming log entries should have timestamps that are no more than
     * the [logs retention period](/logging/quota-policy) in the past,
     * and no more than 24 hours in the future.
     * See the `entries.write` API method for more information.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp timestamp = 9;</code>
     */
    public Builder clearTimestamp() {
      if (timestampBuilder_ == null) {
        timestamp_ = null;
        onChanged();
      } else {
        timestamp_ = null;
        timestampBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Optional. The time the event described by the log entry occurred.
     * This time is used to compute the log entry's age and to enforce
     * the logs retention period. If this field is omitted in a new log
     * entry, then Stackdriver Logging assigns it the current time.
     * Incoming log entries should have timestamps that are no more than
     * the [logs retention period](/logging/quota-policy) in the past,
     * and no more than 24 hours in the future.
     * See the `entries.write` API method for more information.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp timestamp = 9;</code>
     */
    public com.google.protobuf.Timestamp.Builder getTimestampBuilder() {
      
      onChanged();
      return getTimestampFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Optional. The time the event described by the log entry occurred.
     * This time is used to compute the log entry's age and to enforce
     * the logs retention period. If this field is omitted in a new log
     * entry, then Stackdriver Logging assigns it the current time.
     * Incoming log entries should have timestamps that are no more than
     * the [logs retention period](/logging/quota-policy) in the past,
     * and no more than 24 hours in the future.
     * See the `entries.write` API method for more information.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp timestamp = 9;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() {
      if (timestampBuilder_ != null) {
        return timestampBuilder_.getMessageOrBuilder();
      } else {
        return timestamp_ == null ?
            com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_;
      }
    }
    /**
     * <pre>
     * Optional. The time the event described by the log entry occurred.
     * This time is used to compute the log entry's age and to enforce
     * the logs retention period. If this field is omitted in a new log
     * entry, then Stackdriver Logging assigns it the current time.
     * Incoming log entries should have timestamps that are no more than
     * the [logs retention period](/logging/quota-policy) in the past,
     * and no more than 24 hours in the future.
     * See the `entries.write` API method for more information.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp timestamp = 9;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> 
        getTimestampFieldBuilder() {
      if (timestampBuilder_ == null) {
        timestampBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>(
                getTimestamp(),
                getParentForChildren(),
                isClean());
        timestamp_ = null;
      }
      return timestampBuilder_;
    }

    private com.google.protobuf.Timestamp receiveTimestamp_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> receiveTimestampBuilder_;
    /**
     * <pre>
     * Output only. The time the log entry was received by Stackdriver Logging.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
     */
    public boolean hasReceiveTimestamp() {
      return receiveTimestampBuilder_ != null || receiveTimestamp_ != null;
    }
    /**
     * <pre>
     * Output only. The time the log entry was received by Stackdriver Logging.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
     */
    public com.google.protobuf.Timestamp getReceiveTimestamp() {
      if (receiveTimestampBuilder_ == null) {
        return receiveTimestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : receiveTimestamp_;
      } else {
        return receiveTimestampBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Output only. The time the log entry was received by Stackdriver Logging.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
     */
    public Builder setReceiveTimestamp(com.google.protobuf.Timestamp value) {
      if (receiveTimestampBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        receiveTimestamp_ = value;
        onChanged();
      } else {
        receiveTimestampBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Output only. The time the log entry was received by Stackdriver Logging.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
     */
    public Builder setReceiveTimestamp(
        com.google.protobuf.Timestamp.Builder builderForValue) {
      if (receiveTimestampBuilder_ == null) {
        receiveTimestamp_ = builderForValue.build();
        onChanged();
      } else {
        receiveTimestampBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Output only. The time the log entry was received by Stackdriver Logging.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
     */
    public Builder mergeReceiveTimestamp(com.google.protobuf.Timestamp value) {
      if (receiveTimestampBuilder_ == null) {
        if (receiveTimestamp_ != null) {
          receiveTimestamp_ =
            com.google.protobuf.Timestamp.newBuilder(receiveTimestamp_).mergeFrom(value).buildPartial();
        } else {
          receiveTimestamp_ = value;
        }
        onChanged();
      } else {
        receiveTimestampBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Output only. The time the log entry was received by Stackdriver Logging.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
     */
    public Builder clearReceiveTimestamp() {
      if (receiveTimestampBuilder_ == null) {
        receiveTimestamp_ = null;
        onChanged();
      } else {
        receiveTimestamp_ = null;
        receiveTimestampBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Output only. The time the log entry was received by Stackdriver Logging.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
     */
    public com.google.protobuf.Timestamp.Builder getReceiveTimestampBuilder() {
      
      onChanged();
      return getReceiveTimestampFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Output only. The time the log entry was received by Stackdriver Logging.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getReceiveTimestampOrBuilder() {
      if (receiveTimestampBuilder_ != null) {
        return receiveTimestampBuilder_.getMessageOrBuilder();
      } else {
        return receiveTimestamp_ == null ?
            com.google.protobuf.Timestamp.getDefaultInstance() : receiveTimestamp_;
      }
    }
    /**
     * <pre>
     * Output only. The time the log entry was received by Stackdriver Logging.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp receive_timestamp = 24;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> 
        getReceiveTimestampFieldBuilder() {
      if (receiveTimestampBuilder_ == null) {
        receiveTimestampBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>(
                getReceiveTimestamp(),
                getParentForChildren(),
                isClean());
        receiveTimestamp_ = null;
      }
      return receiveTimestampBuilder_;
    }

    private int severity_ = 0;
    /**
     * <pre>
     * Optional. The severity of the log entry. The default value is
     * `LogSeverity.DEFAULT`.
     * </pre>
     *
     * <code>.google.logging.type.LogSeverity severity = 10;</code>
     */
    public int getSeverityValue() {
      return severity_;
    }
    /**
     * <pre>
     * Optional. The severity of the log entry. The default value is
     * `LogSeverity.DEFAULT`.
     * </pre>
     *
     * <code>.google.logging.type.LogSeverity severity = 10;</code>
     */
    public Builder setSeverityValue(int value) {
      severity_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. The severity of the log entry. The default value is
     * `LogSeverity.DEFAULT`.
     * </pre>
     *
     * <code>.google.logging.type.LogSeverity severity = 10;</code>
     */
    public com.google.logging.type.LogSeverity getSeverity() {
      com.google.logging.type.LogSeverity result = com.google.logging.type.LogSeverity.valueOf(severity_);
      return result == null ? com.google.logging.type.LogSeverity.UNRECOGNIZED : result;
    }
    /**
     * <pre>
     * Optional. The severity of the log entry. The default value is
     * `LogSeverity.DEFAULT`.
     * </pre>
     *
     * <code>.google.logging.type.LogSeverity severity = 10;</code>
     */
    public Builder setSeverity(com.google.logging.type.LogSeverity value) {
      if (value == null) {
        throw new NullPointerException();
      }
      
      severity_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. The severity of the log entry. The default value is
     * `LogSeverity.DEFAULT`.
     * </pre>
     *
     * <code>.google.logging.type.LogSeverity severity = 10;</code>
     */
    public Builder clearSeverity() {
      
      severity_ = 0;
      onChanged();
      return this;
    }

    private java.lang.Object insertId_ = "";
    /**
     * <pre>
     * Optional. A unique identifier for the log entry. If you provide a value,
     * then Stackdriver Logging considers other log entries in the same project,
     * with the same `timestamp`, and with the same `insert_id` to be duplicates
     * which can be removed.  If omitted in new log entries, then Stackdriver
     * Logging assigns its own unique identifier. The `insert_id` is also used
     * to order log entries that have the same `timestamp` value.
     * </pre>
     *
     * <code>string insert_id = 4;</code>
     */
    public java.lang.String getInsertId() {
      java.lang.Object ref = insertId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        insertId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Optional. A unique identifier for the log entry. If you provide a value,
     * then Stackdriver Logging considers other log entries in the same project,
     * with the same `timestamp`, and with the same `insert_id` to be duplicates
     * which can be removed.  If omitted in new log entries, then Stackdriver
     * Logging assigns its own unique identifier. The `insert_id` is also used
     * to order log entries that have the same `timestamp` value.
     * </pre>
     *
     * <code>string insert_id = 4;</code>
     */
    public com.google.protobuf.ByteString
        getInsertIdBytes() {
      java.lang.Object ref = insertId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        insertId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Optional. A unique identifier for the log entry. If you provide a value,
     * then Stackdriver Logging considers other log entries in the same project,
     * with the same `timestamp`, and with the same `insert_id` to be duplicates
     * which can be removed.  If omitted in new log entries, then Stackdriver
     * Logging assigns its own unique identifier. The `insert_id` is also used
     * to order log entries that have the same `timestamp` value.
     * </pre>
     *
     * <code>string insert_id = 4;</code>
     */
    public Builder setInsertId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      insertId_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. A unique identifier for the log entry. If you provide a value,
     * then Stackdriver Logging considers other log entries in the same project,
     * with the same `timestamp`, and with the same `insert_id` to be duplicates
     * which can be removed.  If omitted in new log entries, then Stackdriver
     * Logging assigns its own unique identifier. The `insert_id` is also used
     * to order log entries that have the same `timestamp` value.
     * </pre>
     *
     * <code>string insert_id = 4;</code>
     */
    public Builder clearInsertId() {
      
      insertId_ = getDefaultInstance().getInsertId();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. A unique identifier for the log entry. If you provide a value,
     * then Stackdriver Logging considers other log entries in the same project,
     * with the same `timestamp`, and with the same `insert_id` to be duplicates
     * which can be removed.  If omitted in new log entries, then Stackdriver
     * Logging assigns its own unique identifier. The `insert_id` is also used
     * to order log entries that have the same `timestamp` value.
     * </pre>
     *
     * <code>string insert_id = 4;</code>
     */
    public Builder setInsertIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      insertId_ = value;
      onChanged();
      return this;
    }

    private com.google.logging.type.HttpRequest httpRequest_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.logging.type.HttpRequest, com.google.logging.type.HttpRequest.Builder, com.google.logging.type.HttpRequestOrBuilder> httpRequestBuilder_;
    /**
     * <pre>
     * Optional. Information about the HTTP request associated with this
     * log entry, if applicable.
     * </pre>
     *
     * <code>.google.logging.type.HttpRequest http_request = 7;</code>
     */
    public boolean hasHttpRequest() {
      return httpRequestBuilder_ != null || httpRequest_ != null;
    }
    /**
     * <pre>
     * Optional. Information about the HTTP request associated with this
     * log entry, if applicable.
     * </pre>
     *
     * <code>.google.logging.type.HttpRequest http_request = 7;</code>
     */
    public com.google.logging.type.HttpRequest getHttpRequest() {
      if (httpRequestBuilder_ == null) {
        return httpRequest_ == null ? com.google.logging.type.HttpRequest.getDefaultInstance() : httpRequest_;
      } else {
        return httpRequestBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Optional. Information about the HTTP request associated with this
     * log entry, if applicable.
     * </pre>
     *
     * <code>.google.logging.type.HttpRequest http_request = 7;</code>
     */
    public Builder setHttpRequest(com.google.logging.type.HttpRequest value) {
      if (httpRequestBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        httpRequest_ = value;
        onChanged();
      } else {
        httpRequestBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Information about the HTTP request associated with this
     * log entry, if applicable.
     * </pre>
     *
     * <code>.google.logging.type.HttpRequest http_request = 7;</code>
     */
    public Builder setHttpRequest(
        com.google.logging.type.HttpRequest.Builder builderForValue) {
      if (httpRequestBuilder_ == null) {
        httpRequest_ = builderForValue.build();
        onChanged();
      } else {
        httpRequestBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Information about the HTTP request associated with this
     * log entry, if applicable.
     * </pre>
     *
     * <code>.google.logging.type.HttpRequest http_request = 7;</code>
     */
    public Builder mergeHttpRequest(com.google.logging.type.HttpRequest value) {
      if (httpRequestBuilder_ == null) {
        if (httpRequest_ != null) {
          httpRequest_ =
            com.google.logging.type.HttpRequest.newBuilder(httpRequest_).mergeFrom(value).buildPartial();
        } else {
          httpRequest_ = value;
        }
        onChanged();
      } else {
        httpRequestBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Information about the HTTP request associated with this
     * log entry, if applicable.
     * </pre>
     *
     * <code>.google.logging.type.HttpRequest http_request = 7;</code>
     */
    public Builder clearHttpRequest() {
      if (httpRequestBuilder_ == null) {
        httpRequest_ = null;
        onChanged();
      } else {
        httpRequest_ = null;
        httpRequestBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Information about the HTTP request associated with this
     * log entry, if applicable.
     * </pre>
     *
     * <code>.google.logging.type.HttpRequest http_request = 7;</code>
     */
    public com.google.logging.type.HttpRequest.Builder getHttpRequestBuilder() {
      
      onChanged();
      return getHttpRequestFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Optional. Information about the HTTP request associated with this
     * log entry, if applicable.
     * </pre>
     *
     * <code>.google.logging.type.HttpRequest http_request = 7;</code>
     */
    public com.google.logging.type.HttpRequestOrBuilder getHttpRequestOrBuilder() {
      if (httpRequestBuilder_ != null) {
        return httpRequestBuilder_.getMessageOrBuilder();
      } else {
        return httpRequest_ == null ?
            com.google.logging.type.HttpRequest.getDefaultInstance() : httpRequest_;
      }
    }
    /**
     * <pre>
     * Optional. Information about the HTTP request associated with this
     * log entry, if applicable.
     * </pre>
     *
     * <code>.google.logging.type.HttpRequest http_request = 7;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.logging.type.HttpRequest, com.google.logging.type.HttpRequest.Builder, com.google.logging.type.HttpRequestOrBuilder> 
        getHttpRequestFieldBuilder() {
      if (httpRequestBuilder_ == null) {
        httpRequestBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.logging.type.HttpRequest, com.google.logging.type.HttpRequest.Builder, com.google.logging.type.HttpRequestOrBuilder>(
                getHttpRequest(),
                getParentForChildren(),
                isClean());
        httpRequest_ = null;
      }
      return httpRequestBuilder_;
    }

    private com.google.protobuf.MapField<
        java.lang.String, java.lang.String> labels_;
    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
    internalGetLabels() {
      if (labels_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            LabelsDefaultEntryHolder.defaultEntry);
      }
      return labels_;
    }
    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
    internalGetMutableLabels() {
      onChanged();;
      if (labels_ == null) {
        labels_ = com.google.protobuf.MapField.newMapField(
            LabelsDefaultEntryHolder.defaultEntry);
      }
      if (!labels_.isMutable()) {
        labels_ = labels_.copy();
      }
      return labels_;
    }

    public int getLabelsCount() {
      return internalGetLabels().getMap().size();
    }
    /**
     * <pre>
     * Optional. A set of user-defined (key, value) data that provides additional
     * information about the log entry.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 11;</code>
     */

    public boolean containsLabels(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      return internalGetLabels().getMap().containsKey(key);
    }
    /**
     * Use {@link #getLabelsMap()} instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getLabels() {
      return getLabelsMap();
    }
    /**
     * <pre>
     * Optional. A set of user-defined (key, value) data that provides additional
     * information about the log entry.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 11;</code>
     */

    public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
      return internalGetLabels().getMap();
    }
    /**
     * <pre>
     * Optional. A set of user-defined (key, value) data that provides additional
     * information about the log entry.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 11;</code>
     */

    public java.lang.String getLabelsOrDefault(
        java.lang.String key,
        java.lang.String defaultValue) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, java.lang.String> map =
          internalGetLabels().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     * <pre>
     * Optional. A set of user-defined (key, value) data that provides additional
     * information about the log entry.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 11;</code>
     */

    public java.lang.String getLabelsOrThrow(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, java.lang.String> map =
          internalGetLabels().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearLabels() {
      internalGetMutableLabels().getMutableMap()
          .clear();
      return this;
    }
    /**
     * <pre>
     * Optional. A set of user-defined (key, value) data that provides additional
     * information about the log entry.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 11;</code>
     */

    public Builder removeLabels(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableLabels().getMutableMap()
          .remove(key);
      return this;
    }
    /**
     * Use alternate mutation accessors instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String>
    getMutableLabels() {
      return internalGetMutableLabels().getMutableMap();
    }
    /**
     * <pre>
     * Optional. A set of user-defined (key, value) data that provides additional
     * information about the log entry.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 11;</code>
     */
    public Builder putLabels(
        java.lang.String key,
        java.lang.String value) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      if (value == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableLabels().getMutableMap()
          .put(key, value);
      return this;
    }
    /**
     * <pre>
     * Optional. A set of user-defined (key, value) data that provides additional
     * information about the log entry.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 11;</code>
     */

    public Builder putAllLabels(
        java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableLabels().getMutableMap()
          .putAll(values);
      return this;
    }

    private com.google.logging.v2.LogEntryOperation operation_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.logging.v2.LogEntryOperation, com.google.logging.v2.LogEntryOperation.Builder, com.google.logging.v2.LogEntryOperationOrBuilder> operationBuilder_;
    /**
     * <pre>
     * Optional. Information about an operation associated with the log entry, if
     * applicable.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
     */
    public boolean hasOperation() {
      return operationBuilder_ != null || operation_ != null;
    }
    /**
     * <pre>
     * Optional. Information about an operation associated with the log entry, if
     * applicable.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
     */
    public com.google.logging.v2.LogEntryOperation getOperation() {
      if (operationBuilder_ == null) {
        return operation_ == null ? com.google.logging.v2.LogEntryOperation.getDefaultInstance() : operation_;
      } else {
        return operationBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Optional. Information about an operation associated with the log entry, if
     * applicable.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
     */
    public Builder setOperation(com.google.logging.v2.LogEntryOperation value) {
      if (operationBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        operation_ = value;
        onChanged();
      } else {
        operationBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Information about an operation associated with the log entry, if
     * applicable.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
     */
    public Builder setOperation(
        com.google.logging.v2.LogEntryOperation.Builder builderForValue) {
      if (operationBuilder_ == null) {
        operation_ = builderForValue.build();
        onChanged();
      } else {
        operationBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Information about an operation associated with the log entry, if
     * applicable.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
     */
    public Builder mergeOperation(com.google.logging.v2.LogEntryOperation value) {
      if (operationBuilder_ == null) {
        if (operation_ != null) {
          operation_ =
            com.google.logging.v2.LogEntryOperation.newBuilder(operation_).mergeFrom(value).buildPartial();
        } else {
          operation_ = value;
        }
        onChanged();
      } else {
        operationBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Information about an operation associated with the log entry, if
     * applicable.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
     */
    public Builder clearOperation() {
      if (operationBuilder_ == null) {
        operation_ = null;
        onChanged();
      } else {
        operation_ = null;
        operationBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Information about an operation associated with the log entry, if
     * applicable.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
     */
    public com.google.logging.v2.LogEntryOperation.Builder getOperationBuilder() {
      
      onChanged();
      return getOperationFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Optional. Information about an operation associated with the log entry, if
     * applicable.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
     */
    public com.google.logging.v2.LogEntryOperationOrBuilder getOperationOrBuilder() {
      if (operationBuilder_ != null) {
        return operationBuilder_.getMessageOrBuilder();
      } else {
        return operation_ == null ?
            com.google.logging.v2.LogEntryOperation.getDefaultInstance() : operation_;
      }
    }
    /**
     * <pre>
     * Optional. Information about an operation associated with the log entry, if
     * applicable.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntryOperation operation = 15;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.logging.v2.LogEntryOperation, com.google.logging.v2.LogEntryOperation.Builder, com.google.logging.v2.LogEntryOperationOrBuilder> 
        getOperationFieldBuilder() {
      if (operationBuilder_ == null) {
        operationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.logging.v2.LogEntryOperation, com.google.logging.v2.LogEntryOperation.Builder, com.google.logging.v2.LogEntryOperationOrBuilder>(
                getOperation(),
                getParentForChildren(),
                isClean());
        operation_ = null;
      }
      return operationBuilder_;
    }

    private java.lang.Object trace_ = "";
    /**
     * <pre>
     * Optional. Resource name of the trace associated with the log entry, if any.
     * If it contains a relative resource name, the name is assumed to be relative
     * to `//tracing.googleapis.com`. Example:
     * `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
     * </pre>
     *
     * <code>string trace = 22;</code>
     */
    public java.lang.String getTrace() {
      java.lang.Object ref = trace_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        trace_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Optional. Resource name of the trace associated with the log entry, if any.
     * If it contains a relative resource name, the name is assumed to be relative
     * to `//tracing.googleapis.com`. Example:
     * `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
     * </pre>
     *
     * <code>string trace = 22;</code>
     */
    public com.google.protobuf.ByteString
        getTraceBytes() {
      java.lang.Object ref = trace_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        trace_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Optional. Resource name of the trace associated with the log entry, if any.
     * If it contains a relative resource name, the name is assumed to be relative
     * to `//tracing.googleapis.com`. Example:
     * `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
     * </pre>
     *
     * <code>string trace = 22;</code>
     */
    public Builder setTrace(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      trace_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. Resource name of the trace associated with the log entry, if any.
     * If it contains a relative resource name, the name is assumed to be relative
     * to `//tracing.googleapis.com`. Example:
     * `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
     * </pre>
     *
     * <code>string trace = 22;</code>
     */
    public Builder clearTrace() {
      
      trace_ = getDefaultInstance().getTrace();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. Resource name of the trace associated with the log entry, if any.
     * If it contains a relative resource name, the name is assumed to be relative
     * to `//tracing.googleapis.com`. Example:
     * `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
     * </pre>
     *
     * <code>string trace = 22;</code>
     */
    public Builder setTraceBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      trace_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object spanId_ = "";
    /**
     * <pre>
     * Optional. Id of the span within the trace associated with the log entry.
     * e.g. "0000000000000042"
     * For Stackdriver trace spans, this is the same format that the Stackdriver
     * trace API uses.
     * The ID is a 16-character hexadecimal encoding of an 8-byte array.
     * </pre>
     *
     * <code>string span_id = 27;</code>
     */
    public java.lang.String getSpanId() {
      java.lang.Object ref = spanId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        spanId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Optional. Id of the span within the trace associated with the log entry.
     * e.g. "0000000000000042"
     * For Stackdriver trace spans, this is the same format that the Stackdriver
     * trace API uses.
     * The ID is a 16-character hexadecimal encoding of an 8-byte array.
     * </pre>
     *
     * <code>string span_id = 27;</code>
     */
    public com.google.protobuf.ByteString
        getSpanIdBytes() {
      java.lang.Object ref = spanId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        spanId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Optional. Id of the span within the trace associated with the log entry.
     * e.g. "0000000000000042"
     * For Stackdriver trace spans, this is the same format that the Stackdriver
     * trace API uses.
     * The ID is a 16-character hexadecimal encoding of an 8-byte array.
     * </pre>
     *
     * <code>string span_id = 27;</code>
     */
    public Builder setSpanId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      spanId_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. Id of the span within the trace associated with the log entry.
     * e.g. "0000000000000042"
     * For Stackdriver trace spans, this is the same format that the Stackdriver
     * trace API uses.
     * The ID is a 16-character hexadecimal encoding of an 8-byte array.
     * </pre>
     *
     * <code>string span_id = 27;</code>
     */
    public Builder clearSpanId() {
      
      spanId_ = getDefaultInstance().getSpanId();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. Id of the span within the trace associated with the log entry.
     * e.g. "0000000000000042"
     * For Stackdriver trace spans, this is the same format that the Stackdriver
     * trace API uses.
     * The ID is a 16-character hexadecimal encoding of an 8-byte array.
     * </pre>
     *
     * <code>string span_id = 27;</code>
     */
    public Builder setSpanIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      spanId_ = value;
      onChanged();
      return this;
    }

    private com.google.logging.v2.LogEntrySourceLocation sourceLocation_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.logging.v2.LogEntrySourceLocation, com.google.logging.v2.LogEntrySourceLocation.Builder, com.google.logging.v2.LogEntrySourceLocationOrBuilder> sourceLocationBuilder_;
    /**
     * <pre>
     * Optional. Source code location information associated with the log entry,
     * if any.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
     */
    public boolean hasSourceLocation() {
      return sourceLocationBuilder_ != null || sourceLocation_ != null;
    }
    /**
     * <pre>
     * Optional. Source code location information associated with the log entry,
     * if any.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
     */
    public com.google.logging.v2.LogEntrySourceLocation getSourceLocation() {
      if (sourceLocationBuilder_ == null) {
        return sourceLocation_ == null ? com.google.logging.v2.LogEntrySourceLocation.getDefaultInstance() : sourceLocation_;
      } else {
        return sourceLocationBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Optional. Source code location information associated with the log entry,
     * if any.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
     */
    public Builder setSourceLocation(com.google.logging.v2.LogEntrySourceLocation value) {
      if (sourceLocationBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        sourceLocation_ = value;
        onChanged();
      } else {
        sourceLocationBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Source code location information associated with the log entry,
     * if any.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
     */
    public Builder setSourceLocation(
        com.google.logging.v2.LogEntrySourceLocation.Builder builderForValue) {
      if (sourceLocationBuilder_ == null) {
        sourceLocation_ = builderForValue.build();
        onChanged();
      } else {
        sourceLocationBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Source code location information associated with the log entry,
     * if any.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
     */
    public Builder mergeSourceLocation(com.google.logging.v2.LogEntrySourceLocation value) {
      if (sourceLocationBuilder_ == null) {
        if (sourceLocation_ != null) {
          sourceLocation_ =
            com.google.logging.v2.LogEntrySourceLocation.newBuilder(sourceLocation_).mergeFrom(value).buildPartial();
        } else {
          sourceLocation_ = value;
        }
        onChanged();
      } else {
        sourceLocationBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Source code location information associated with the log entry,
     * if any.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
     */
    public Builder clearSourceLocation() {
      if (sourceLocationBuilder_ == null) {
        sourceLocation_ = null;
        onChanged();
      } else {
        sourceLocation_ = null;
        sourceLocationBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Source code location information associated with the log entry,
     * if any.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
     */
    public com.google.logging.v2.LogEntrySourceLocation.Builder getSourceLocationBuilder() {
      
      onChanged();
      return getSourceLocationFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Optional. Source code location information associated with the log entry,
     * if any.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
     */
    public com.google.logging.v2.LogEntrySourceLocationOrBuilder getSourceLocationOrBuilder() {
      if (sourceLocationBuilder_ != null) {
        return sourceLocationBuilder_.getMessageOrBuilder();
      } else {
        return sourceLocation_ == null ?
            com.google.logging.v2.LogEntrySourceLocation.getDefaultInstance() : sourceLocation_;
      }
    }
    /**
     * <pre>
     * Optional. Source code location information associated with the log entry,
     * if any.
     * </pre>
     *
     * <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.logging.v2.LogEntrySourceLocation, com.google.logging.v2.LogEntrySourceLocation.Builder, com.google.logging.v2.LogEntrySourceLocationOrBuilder> 
        getSourceLocationFieldBuilder() {
      if (sourceLocationBuilder_ == null) {
        sourceLocationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.logging.v2.LogEntrySourceLocation, com.google.logging.v2.LogEntrySourceLocation.Builder, com.google.logging.v2.LogEntrySourceLocationOrBuilder>(
                getSourceLocation(),
                getParentForChildren(),
                isClean());
        sourceLocation_ = null;
      }
      return sourceLocationBuilder_;
    }
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(unknownFields);
    }

    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:google.logging.v2.LogEntry)
  }

  // @@protoc_insertion_point(class_scope:google.logging.v2.LogEntry)
  private static final com.google.logging.v2.LogEntry DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.logging.v2.LogEntry();
  }

  public static com.google.logging.v2.LogEntry getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  public com.google.logging.v2.LogEntry getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

