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

package com.google.dataflow.v1beta3;

/**
 *
 *
 * <pre>
 * Describes the state of a metric.
 * </pre>
 *
 * Protobuf type {@code google.dataflow.v1beta3.MetricUpdate}
 */
public final class MetricUpdate extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.dataflow.v1beta3.MetricUpdate)
    MetricUpdateOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use MetricUpdate.newBuilder() to construct.
  private MetricUpdate(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private MetricUpdate() {
    kind_ = "";
  }

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

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

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

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

              kind_ = s;
              break;
            }
          case 24:
            {
              cumulative_ = input.readBool();
              break;
            }
          case 34:
            {
              com.google.protobuf.Value.Builder subBuilder = null;
              if (scalar_ != null) {
                subBuilder = scalar_.toBuilder();
              }
              scalar_ = input.readMessage(com.google.protobuf.Value.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(scalar_);
                scalar_ = subBuilder.buildPartial();
              }

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

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

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

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

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

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

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

              break;
            }
          default:
            {
              if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (com.google.protobuf.UninitializedMessageException e) {
      throw e.asInvalidProtocolBufferException().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.dataflow.v1beta3.MetricsProto
        .internal_static_google_dataflow_v1beta3_MetricUpdate_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.dataflow.v1beta3.MetricsProto
        .internal_static_google_dataflow_v1beta3_MetricUpdate_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.dataflow.v1beta3.MetricUpdate.class,
            com.google.dataflow.v1beta3.MetricUpdate.Builder.class);
  }

  public static final int NAME_FIELD_NUMBER = 1;
  private com.google.dataflow.v1beta3.MetricStructuredName name_;
  /**
   *
   *
   * <pre>
   * Name of the metric.
   * </pre>
   *
   * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
   *
   * @return Whether the name field is set.
   */
  @java.lang.Override
  public boolean hasName() {
    return name_ != null;
  }
  /**
   *
   *
   * <pre>
   * Name of the metric.
   * </pre>
   *
   * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
   *
   * @return The name.
   */
  @java.lang.Override
  public com.google.dataflow.v1beta3.MetricStructuredName getName() {
    return name_ == null
        ? com.google.dataflow.v1beta3.MetricStructuredName.getDefaultInstance()
        : name_;
  }
  /**
   *
   *
   * <pre>
   * Name of the metric.
   * </pre>
   *
   * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
   */
  @java.lang.Override
  public com.google.dataflow.v1beta3.MetricStructuredNameOrBuilder getNameOrBuilder() {
    return getName();
  }

  public static final int KIND_FIELD_NUMBER = 2;
  private volatile java.lang.Object kind_;
  /**
   *
   *
   * <pre>
   * Metric aggregation kind.  The possible metric aggregation kinds are
   * "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution".
   * The specified aggregation kind is case-insensitive.
   * If omitted, this is not an aggregated value but instead
   * a single metric sample value.
   * </pre>
   *
   * <code>string kind = 2;</code>
   *
   * @return The kind.
   */
  @java.lang.Override
  public java.lang.String getKind() {
    java.lang.Object ref = kind_;
    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();
      kind_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Metric aggregation kind.  The possible metric aggregation kinds are
   * "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution".
   * The specified aggregation kind is case-insensitive.
   * If omitted, this is not an aggregated value but instead
   * a single metric sample value.
   * </pre>
   *
   * <code>string kind = 2;</code>
   *
   * @return The bytes for kind.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getKindBytes() {
    java.lang.Object ref = kind_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      kind_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int CUMULATIVE_FIELD_NUMBER = 3;
  private boolean cumulative_;
  /**
   *
   *
   * <pre>
   * True if this metric is reported as the total cumulative aggregate
   * value accumulated since the worker started working on this WorkItem.
   * By default this is false, indicating that this metric is reported
   * as a delta that is not associated with any WorkItem.
   * </pre>
   *
   * <code>bool cumulative = 3;</code>
   *
   * @return The cumulative.
   */
  @java.lang.Override
  public boolean getCumulative() {
    return cumulative_;
  }

  public static final int SCALAR_FIELD_NUMBER = 4;
  private com.google.protobuf.Value scalar_;
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
   * "And", and "Or".  The possible value types are Long, Double, and Boolean.
   * </pre>
   *
   * <code>.google.protobuf.Value scalar = 4;</code>
   *
   * @return Whether the scalar field is set.
   */
  @java.lang.Override
  public boolean hasScalar() {
    return scalar_ != null;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
   * "And", and "Or".  The possible value types are Long, Double, and Boolean.
   * </pre>
   *
   * <code>.google.protobuf.Value scalar = 4;</code>
   *
   * @return The scalar.
   */
  @java.lang.Override
  public com.google.protobuf.Value getScalar() {
    return scalar_ == null ? com.google.protobuf.Value.getDefaultInstance() : scalar_;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
   * "And", and "Or".  The possible value types are Long, Double, and Boolean.
   * </pre>
   *
   * <code>.google.protobuf.Value scalar = 4;</code>
   */
  @java.lang.Override
  public com.google.protobuf.ValueOrBuilder getScalarOrBuilder() {
    return getScalar();
  }

  public static final int MEAN_SUM_FIELD_NUMBER = 5;
  private com.google.protobuf.Value meanSum_;
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for the "Mean" aggregation kind.
   * This holds the sum of the aggregated values and is used in combination
   * with mean_count below to obtain the actual mean aggregate value.
   * The only possible value types are Long and Double.
   * </pre>
   *
   * <code>.google.protobuf.Value mean_sum = 5;</code>
   *
   * @return Whether the meanSum field is set.
   */
  @java.lang.Override
  public boolean hasMeanSum() {
    return meanSum_ != null;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for the "Mean" aggregation kind.
   * This holds the sum of the aggregated values and is used in combination
   * with mean_count below to obtain the actual mean aggregate value.
   * The only possible value types are Long and Double.
   * </pre>
   *
   * <code>.google.protobuf.Value mean_sum = 5;</code>
   *
   * @return The meanSum.
   */
  @java.lang.Override
  public com.google.protobuf.Value getMeanSum() {
    return meanSum_ == null ? com.google.protobuf.Value.getDefaultInstance() : meanSum_;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for the "Mean" aggregation kind.
   * This holds the sum of the aggregated values and is used in combination
   * with mean_count below to obtain the actual mean aggregate value.
   * The only possible value types are Long and Double.
   * </pre>
   *
   * <code>.google.protobuf.Value mean_sum = 5;</code>
   */
  @java.lang.Override
  public com.google.protobuf.ValueOrBuilder getMeanSumOrBuilder() {
    return getMeanSum();
  }

  public static final int MEAN_COUNT_FIELD_NUMBER = 6;
  private com.google.protobuf.Value meanCount_;
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for the "Mean" aggregation kind.
   * This holds the count of the aggregated values and is used in combination
   * with mean_sum above to obtain the actual mean aggregate value.
   * The only possible value type is Long.
   * </pre>
   *
   * <code>.google.protobuf.Value mean_count = 6;</code>
   *
   * @return Whether the meanCount field is set.
   */
  @java.lang.Override
  public boolean hasMeanCount() {
    return meanCount_ != null;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for the "Mean" aggregation kind.
   * This holds the count of the aggregated values and is used in combination
   * with mean_sum above to obtain the actual mean aggregate value.
   * The only possible value type is Long.
   * </pre>
   *
   * <code>.google.protobuf.Value mean_count = 6;</code>
   *
   * @return The meanCount.
   */
  @java.lang.Override
  public com.google.protobuf.Value getMeanCount() {
    return meanCount_ == null ? com.google.protobuf.Value.getDefaultInstance() : meanCount_;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for the "Mean" aggregation kind.
   * This holds the count of the aggregated values and is used in combination
   * with mean_sum above to obtain the actual mean aggregate value.
   * The only possible value type is Long.
   * </pre>
   *
   * <code>.google.protobuf.Value mean_count = 6;</code>
   */
  @java.lang.Override
  public com.google.protobuf.ValueOrBuilder getMeanCountOrBuilder() {
    return getMeanCount();
  }

  public static final int SET_FIELD_NUMBER = 7;
  private com.google.protobuf.Value set_;
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for the "Set" aggregation kind.  The only
   * possible value type is a list of Values whose type can be Long, Double,
   * or String, according to the metric's type.  All Values in the list must
   * be of the same type.
   * </pre>
   *
   * <code>.google.protobuf.Value set = 7;</code>
   *
   * @return Whether the set field is set.
   */
  @java.lang.Override
  public boolean hasSet() {
    return set_ != null;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for the "Set" aggregation kind.  The only
   * possible value type is a list of Values whose type can be Long, Double,
   * or String, according to the metric's type.  All Values in the list must
   * be of the same type.
   * </pre>
   *
   * <code>.google.protobuf.Value set = 7;</code>
   *
   * @return The set.
   */
  @java.lang.Override
  public com.google.protobuf.Value getSet() {
    return set_ == null ? com.google.protobuf.Value.getDefaultInstance() : set_;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for the "Set" aggregation kind.  The only
   * possible value type is a list of Values whose type can be Long, Double,
   * or String, according to the metric's type.  All Values in the list must
   * be of the same type.
   * </pre>
   *
   * <code>.google.protobuf.Value set = 7;</code>
   */
  @java.lang.Override
  public com.google.protobuf.ValueOrBuilder getSetOrBuilder() {
    return getSet();
  }

  public static final int DISTRIBUTION_FIELD_NUMBER = 11;
  private com.google.protobuf.Value distribution_;
  /**
   *
   *
   * <pre>
   * A struct value describing properties of a distribution of numeric values.
   * </pre>
   *
   * <code>.google.protobuf.Value distribution = 11;</code>
   *
   * @return Whether the distribution field is set.
   */
  @java.lang.Override
  public boolean hasDistribution() {
    return distribution_ != null;
  }
  /**
   *
   *
   * <pre>
   * A struct value describing properties of a distribution of numeric values.
   * </pre>
   *
   * <code>.google.protobuf.Value distribution = 11;</code>
   *
   * @return The distribution.
   */
  @java.lang.Override
  public com.google.protobuf.Value getDistribution() {
    return distribution_ == null ? com.google.protobuf.Value.getDefaultInstance() : distribution_;
  }
  /**
   *
   *
   * <pre>
   * A struct value describing properties of a distribution of numeric values.
   * </pre>
   *
   * <code>.google.protobuf.Value distribution = 11;</code>
   */
  @java.lang.Override
  public com.google.protobuf.ValueOrBuilder getDistributionOrBuilder() {
    return getDistribution();
  }

  public static final int GAUGE_FIELD_NUMBER = 12;
  private com.google.protobuf.Value gauge_;
  /**
   *
   *
   * <pre>
   * A struct value describing properties of a Gauge.
   * Metrics of gauge type show the value of a metric across time, and is
   * aggregated based on the newest value.
   * </pre>
   *
   * <code>.google.protobuf.Value gauge = 12;</code>
   *
   * @return Whether the gauge field is set.
   */
  @java.lang.Override
  public boolean hasGauge() {
    return gauge_ != null;
  }
  /**
   *
   *
   * <pre>
   * A struct value describing properties of a Gauge.
   * Metrics of gauge type show the value of a metric across time, and is
   * aggregated based on the newest value.
   * </pre>
   *
   * <code>.google.protobuf.Value gauge = 12;</code>
   *
   * @return The gauge.
   */
  @java.lang.Override
  public com.google.protobuf.Value getGauge() {
    return gauge_ == null ? com.google.protobuf.Value.getDefaultInstance() : gauge_;
  }
  /**
   *
   *
   * <pre>
   * A struct value describing properties of a Gauge.
   * Metrics of gauge type show the value of a metric across time, and is
   * aggregated based on the newest value.
   * </pre>
   *
   * <code>.google.protobuf.Value gauge = 12;</code>
   */
  @java.lang.Override
  public com.google.protobuf.ValueOrBuilder getGaugeOrBuilder() {
    return getGauge();
  }

  public static final int INTERNAL_FIELD_NUMBER = 8;
  private com.google.protobuf.Value internal_;
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for internal use by the Dataflow
   * service.
   * </pre>
   *
   * <code>.google.protobuf.Value internal = 8;</code>
   *
   * @return Whether the internal field is set.
   */
  @java.lang.Override
  public boolean hasInternal() {
    return internal_ != null;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for internal use by the Dataflow
   * service.
   * </pre>
   *
   * <code>.google.protobuf.Value internal = 8;</code>
   *
   * @return The internal.
   */
  @java.lang.Override
  public com.google.protobuf.Value getInternal() {
    return internal_ == null ? com.google.protobuf.Value.getDefaultInstance() : internal_;
  }
  /**
   *
   *
   * <pre>
   * Worker-computed aggregate value for internal use by the Dataflow
   * service.
   * </pre>
   *
   * <code>.google.protobuf.Value internal = 8;</code>
   */
  @java.lang.Override
  public com.google.protobuf.ValueOrBuilder getInternalOrBuilder() {
    return getInternal();
  }

  public static final int UPDATE_TIME_FIELD_NUMBER = 9;
  private com.google.protobuf.Timestamp updateTime_;
  /**
   *
   *
   * <pre>
   * Timestamp associated with the metric value. Optional when workers are
   * reporting work progress; it will be filled in responses from the
   * metrics API.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 9;</code>
   *
   * @return Whether the updateTime field is set.
   */
  @java.lang.Override
  public boolean hasUpdateTime() {
    return updateTime_ != null;
  }
  /**
   *
   *
   * <pre>
   * Timestamp associated with the metric value. Optional when workers are
   * reporting work progress; it will be filled in responses from the
   * metrics API.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 9;</code>
   *
   * @return The updateTime.
   */
  @java.lang.Override
  public com.google.protobuf.Timestamp getUpdateTime() {
    return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_;
  }
  /**
   *
   *
   * <pre>
   * Timestamp associated with the metric value. Optional when workers are
   * reporting work progress; it will be filled in responses from the
   * metrics API.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 9;</code>
   */
  @java.lang.Override
  public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() {
    return getUpdateTime();
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (name_ != null) {
      output.writeMessage(1, getName());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kind_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, kind_);
    }
    if (cumulative_ != false) {
      output.writeBool(3, cumulative_);
    }
    if (scalar_ != null) {
      output.writeMessage(4, getScalar());
    }
    if (meanSum_ != null) {
      output.writeMessage(5, getMeanSum());
    }
    if (meanCount_ != null) {
      output.writeMessage(6, getMeanCount());
    }
    if (set_ != null) {
      output.writeMessage(7, getSet());
    }
    if (internal_ != null) {
      output.writeMessage(8, getInternal());
    }
    if (updateTime_ != null) {
      output.writeMessage(9, getUpdateTime());
    }
    if (distribution_ != null) {
      output.writeMessage(11, getDistribution());
    }
    if (gauge_ != null) {
      output.writeMessage(12, getGauge());
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (name_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getName());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kind_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, kind_);
    }
    if (cumulative_ != false) {
      size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, cumulative_);
    }
    if (scalar_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getScalar());
    }
    if (meanSum_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getMeanSum());
    }
    if (meanCount_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getMeanCount());
    }
    if (set_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getSet());
    }
    if (internal_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getInternal());
    }
    if (updateTime_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getUpdateTime());
    }
    if (distribution_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, getDistribution());
    }
    if (gauge_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, getGauge());
    }
    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.dataflow.v1beta3.MetricUpdate)) {
      return super.equals(obj);
    }
    com.google.dataflow.v1beta3.MetricUpdate other = (com.google.dataflow.v1beta3.MetricUpdate) obj;

    if (hasName() != other.hasName()) return false;
    if (hasName()) {
      if (!getName().equals(other.getName())) return false;
    }
    if (!getKind().equals(other.getKind())) return false;
    if (getCumulative() != other.getCumulative()) return false;
    if (hasScalar() != other.hasScalar()) return false;
    if (hasScalar()) {
      if (!getScalar().equals(other.getScalar())) return false;
    }
    if (hasMeanSum() != other.hasMeanSum()) return false;
    if (hasMeanSum()) {
      if (!getMeanSum().equals(other.getMeanSum())) return false;
    }
    if (hasMeanCount() != other.hasMeanCount()) return false;
    if (hasMeanCount()) {
      if (!getMeanCount().equals(other.getMeanCount())) return false;
    }
    if (hasSet() != other.hasSet()) return false;
    if (hasSet()) {
      if (!getSet().equals(other.getSet())) return false;
    }
    if (hasDistribution() != other.hasDistribution()) return false;
    if (hasDistribution()) {
      if (!getDistribution().equals(other.getDistribution())) return false;
    }
    if (hasGauge() != other.hasGauge()) return false;
    if (hasGauge()) {
      if (!getGauge().equals(other.getGauge())) return false;
    }
    if (hasInternal() != other.hasInternal()) return false;
    if (hasInternal()) {
      if (!getInternal().equals(other.getInternal())) return false;
    }
    if (hasUpdateTime() != other.hasUpdateTime()) return false;
    if (hasUpdateTime()) {
      if (!getUpdateTime().equals(other.getUpdateTime())) return false;
    }
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasName()) {
      hash = (37 * hash) + NAME_FIELD_NUMBER;
      hash = (53 * hash) + getName().hashCode();
    }
    hash = (37 * hash) + KIND_FIELD_NUMBER;
    hash = (53 * hash) + getKind().hashCode();
    hash = (37 * hash) + CUMULATIVE_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getCumulative());
    if (hasScalar()) {
      hash = (37 * hash) + SCALAR_FIELD_NUMBER;
      hash = (53 * hash) + getScalar().hashCode();
    }
    if (hasMeanSum()) {
      hash = (37 * hash) + MEAN_SUM_FIELD_NUMBER;
      hash = (53 * hash) + getMeanSum().hashCode();
    }
    if (hasMeanCount()) {
      hash = (37 * hash) + MEAN_COUNT_FIELD_NUMBER;
      hash = (53 * hash) + getMeanCount().hashCode();
    }
    if (hasSet()) {
      hash = (37 * hash) + SET_FIELD_NUMBER;
      hash = (53 * hash) + getSet().hashCode();
    }
    if (hasDistribution()) {
      hash = (37 * hash) + DISTRIBUTION_FIELD_NUMBER;
      hash = (53 * hash) + getDistribution().hashCode();
    }
    if (hasGauge()) {
      hash = (37 * hash) + GAUGE_FIELD_NUMBER;
      hash = (53 * hash) + getGauge().hashCode();
    }
    if (hasInternal()) {
      hash = (37 * hash) + INTERNAL_FIELD_NUMBER;
      hash = (53 * hash) + getInternal().hashCode();
    }
    if (hasUpdateTime()) {
      hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER;
      hash = (53 * hash) + getUpdateTime().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.dataflow.v1beta3.MetricUpdate parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.dataflow.v1beta3.MetricUpdate parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.dataflow.v1beta3.MetricUpdate parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

  public static com.google.dataflow.v1beta3.MetricUpdate parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.dataflow.v1beta3.MetricUpdate parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

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

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

  public static com.google.dataflow.v1beta3.MetricUpdate parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.dataflow.v1beta3.MetricUpdate prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   * <pre>
   * Describes the state of a metric.
   * </pre>
   *
   * Protobuf type {@code google.dataflow.v1beta3.MetricUpdate}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.dataflow.v1beta3.MetricUpdate)
      com.google.dataflow.v1beta3.MetricUpdateOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.dataflow.v1beta3.MetricsProto
          .internal_static_google_dataflow_v1beta3_MetricUpdate_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.dataflow.v1beta3.MetricsProto
          .internal_static_google_dataflow_v1beta3_MetricUpdate_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.dataflow.v1beta3.MetricUpdate.class,
              com.google.dataflow.v1beta3.MetricUpdate.Builder.class);
    }

    // Construct using com.google.dataflow.v1beta3.MetricUpdate.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (nameBuilder_ == null) {
        name_ = null;
      } else {
        name_ = null;
        nameBuilder_ = null;
      }
      kind_ = "";

      cumulative_ = false;

      if (scalarBuilder_ == null) {
        scalar_ = null;
      } else {
        scalar_ = null;
        scalarBuilder_ = null;
      }
      if (meanSumBuilder_ == null) {
        meanSum_ = null;
      } else {
        meanSum_ = null;
        meanSumBuilder_ = null;
      }
      if (meanCountBuilder_ == null) {
        meanCount_ = null;
      } else {
        meanCount_ = null;
        meanCountBuilder_ = null;
      }
      if (setBuilder_ == null) {
        set_ = null;
      } else {
        set_ = null;
        setBuilder_ = null;
      }
      if (distributionBuilder_ == null) {
        distribution_ = null;
      } else {
        distribution_ = null;
        distributionBuilder_ = null;
      }
      if (gaugeBuilder_ == null) {
        gauge_ = null;
      } else {
        gauge_ = null;
        gaugeBuilder_ = null;
      }
      if (internalBuilder_ == null) {
        internal_ = null;
      } else {
        internal_ = null;
        internalBuilder_ = null;
      }
      if (updateTimeBuilder_ == null) {
        updateTime_ = null;
      } else {
        updateTime_ = null;
        updateTimeBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.dataflow.v1beta3.MetricsProto
          .internal_static_google_dataflow_v1beta3_MetricUpdate_descriptor;
    }

    @java.lang.Override
    public com.google.dataflow.v1beta3.MetricUpdate getDefaultInstanceForType() {
      return com.google.dataflow.v1beta3.MetricUpdate.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.dataflow.v1beta3.MetricUpdate build() {
      com.google.dataflow.v1beta3.MetricUpdate result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.dataflow.v1beta3.MetricUpdate buildPartial() {
      com.google.dataflow.v1beta3.MetricUpdate result =
          new com.google.dataflow.v1beta3.MetricUpdate(this);
      if (nameBuilder_ == null) {
        result.name_ = name_;
      } else {
        result.name_ = nameBuilder_.build();
      }
      result.kind_ = kind_;
      result.cumulative_ = cumulative_;
      if (scalarBuilder_ == null) {
        result.scalar_ = scalar_;
      } else {
        result.scalar_ = scalarBuilder_.build();
      }
      if (meanSumBuilder_ == null) {
        result.meanSum_ = meanSum_;
      } else {
        result.meanSum_ = meanSumBuilder_.build();
      }
      if (meanCountBuilder_ == null) {
        result.meanCount_ = meanCount_;
      } else {
        result.meanCount_ = meanCountBuilder_.build();
      }
      if (setBuilder_ == null) {
        result.set_ = set_;
      } else {
        result.set_ = setBuilder_.build();
      }
      if (distributionBuilder_ == null) {
        result.distribution_ = distribution_;
      } else {
        result.distribution_ = distributionBuilder_.build();
      }
      if (gaugeBuilder_ == null) {
        result.gauge_ = gauge_;
      } else {
        result.gauge_ = gaugeBuilder_.build();
      }
      if (internalBuilder_ == null) {
        result.internal_ = internal_;
      } else {
        result.internal_ = internalBuilder_.build();
      }
      if (updateTimeBuilder_ == null) {
        result.updateTime_ = updateTime_;
      } else {
        result.updateTime_ = updateTimeBuilder_.build();
      }
      onBuilt();
      return result;
    }

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

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

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

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

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

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

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

    public Builder mergeFrom(com.google.dataflow.v1beta3.MetricUpdate other) {
      if (other == com.google.dataflow.v1beta3.MetricUpdate.getDefaultInstance()) return this;
      if (other.hasName()) {
        mergeName(other.getName());
      }
      if (!other.getKind().isEmpty()) {
        kind_ = other.kind_;
        onChanged();
      }
      if (other.getCumulative() != false) {
        setCumulative(other.getCumulative());
      }
      if (other.hasScalar()) {
        mergeScalar(other.getScalar());
      }
      if (other.hasMeanSum()) {
        mergeMeanSum(other.getMeanSum());
      }
      if (other.hasMeanCount()) {
        mergeMeanCount(other.getMeanCount());
      }
      if (other.hasSet()) {
        mergeSet(other.getSet());
      }
      if (other.hasDistribution()) {
        mergeDistribution(other.getDistribution());
      }
      if (other.hasGauge()) {
        mergeGauge(other.getGauge());
      }
      if (other.hasInternal()) {
        mergeInternal(other.getInternal());
      }
      if (other.hasUpdateTime()) {
        mergeUpdateTime(other.getUpdateTime());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

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

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

    private com.google.dataflow.v1beta3.MetricStructuredName name_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.dataflow.v1beta3.MetricStructuredName,
            com.google.dataflow.v1beta3.MetricStructuredName.Builder,
            com.google.dataflow.v1beta3.MetricStructuredNameOrBuilder>
        nameBuilder_;
    /**
     *
     *
     * <pre>
     * Name of the metric.
     * </pre>
     *
     * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
     *
     * @return Whether the name field is set.
     */
    public boolean hasName() {
      return nameBuilder_ != null || name_ != null;
    }
    /**
     *
     *
     * <pre>
     * Name of the metric.
     * </pre>
     *
     * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
     *
     * @return The name.
     */
    public com.google.dataflow.v1beta3.MetricStructuredName getName() {
      if (nameBuilder_ == null) {
        return name_ == null
            ? com.google.dataflow.v1beta3.MetricStructuredName.getDefaultInstance()
            : name_;
      } else {
        return nameBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Name of the metric.
     * </pre>
     *
     * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
     */
    public Builder setName(com.google.dataflow.v1beta3.MetricStructuredName value) {
      if (nameBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        name_ = value;
        onChanged();
      } else {
        nameBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Name of the metric.
     * </pre>
     *
     * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
     */
    public Builder setName(
        com.google.dataflow.v1beta3.MetricStructuredName.Builder builderForValue) {
      if (nameBuilder_ == null) {
        name_ = builderForValue.build();
        onChanged();
      } else {
        nameBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Name of the metric.
     * </pre>
     *
     * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
     */
    public Builder mergeName(com.google.dataflow.v1beta3.MetricStructuredName value) {
      if (nameBuilder_ == null) {
        if (name_ != null) {
          name_ =
              com.google.dataflow.v1beta3.MetricStructuredName.newBuilder(name_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          name_ = value;
        }
        onChanged();
      } else {
        nameBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Name of the metric.
     * </pre>
     *
     * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
     */
    public Builder clearName() {
      if (nameBuilder_ == null) {
        name_ = null;
        onChanged();
      } else {
        name_ = null;
        nameBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Name of the metric.
     * </pre>
     *
     * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
     */
    public com.google.dataflow.v1beta3.MetricStructuredName.Builder getNameBuilder() {

      onChanged();
      return getNameFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Name of the metric.
     * </pre>
     *
     * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
     */
    public com.google.dataflow.v1beta3.MetricStructuredNameOrBuilder getNameOrBuilder() {
      if (nameBuilder_ != null) {
        return nameBuilder_.getMessageOrBuilder();
      } else {
        return name_ == null
            ? com.google.dataflow.v1beta3.MetricStructuredName.getDefaultInstance()
            : name_;
      }
    }
    /**
     *
     *
     * <pre>
     * Name of the metric.
     * </pre>
     *
     * <code>.google.dataflow.v1beta3.MetricStructuredName name = 1;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.dataflow.v1beta3.MetricStructuredName,
            com.google.dataflow.v1beta3.MetricStructuredName.Builder,
            com.google.dataflow.v1beta3.MetricStructuredNameOrBuilder>
        getNameFieldBuilder() {
      if (nameBuilder_ == null) {
        nameBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.dataflow.v1beta3.MetricStructuredName,
                com.google.dataflow.v1beta3.MetricStructuredName.Builder,
                com.google.dataflow.v1beta3.MetricStructuredNameOrBuilder>(
                getName(), getParentForChildren(), isClean());
        name_ = null;
      }
      return nameBuilder_;
    }

    private java.lang.Object kind_ = "";
    /**
     *
     *
     * <pre>
     * Metric aggregation kind.  The possible metric aggregation kinds are
     * "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution".
     * The specified aggregation kind is case-insensitive.
     * If omitted, this is not an aggregated value but instead
     * a single metric sample value.
     * </pre>
     *
     * <code>string kind = 2;</code>
     *
     * @return The kind.
     */
    public java.lang.String getKind() {
      java.lang.Object ref = kind_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        kind_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Metric aggregation kind.  The possible metric aggregation kinds are
     * "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution".
     * The specified aggregation kind is case-insensitive.
     * If omitted, this is not an aggregated value but instead
     * a single metric sample value.
     * </pre>
     *
     * <code>string kind = 2;</code>
     *
     * @return The bytes for kind.
     */
    public com.google.protobuf.ByteString getKindBytes() {
      java.lang.Object ref = kind_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        kind_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Metric aggregation kind.  The possible metric aggregation kinds are
     * "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution".
     * The specified aggregation kind is case-insensitive.
     * If omitted, this is not an aggregated value but instead
     * a single metric sample value.
     * </pre>
     *
     * <code>string kind = 2;</code>
     *
     * @param value The kind to set.
     * @return This builder for chaining.
     */
    public Builder setKind(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      kind_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Metric aggregation kind.  The possible metric aggregation kinds are
     * "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution".
     * The specified aggregation kind is case-insensitive.
     * If omitted, this is not an aggregated value but instead
     * a single metric sample value.
     * </pre>
     *
     * <code>string kind = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearKind() {

      kind_ = getDefaultInstance().getKind();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Metric aggregation kind.  The possible metric aggregation kinds are
     * "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution".
     * The specified aggregation kind is case-insensitive.
     * If omitted, this is not an aggregated value but instead
     * a single metric sample value.
     * </pre>
     *
     * <code>string kind = 2;</code>
     *
     * @param value The bytes for kind to set.
     * @return This builder for chaining.
     */
    public Builder setKindBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

    private boolean cumulative_;
    /**
     *
     *
     * <pre>
     * True if this metric is reported as the total cumulative aggregate
     * value accumulated since the worker started working on this WorkItem.
     * By default this is false, indicating that this metric is reported
     * as a delta that is not associated with any WorkItem.
     * </pre>
     *
     * <code>bool cumulative = 3;</code>
     *
     * @return The cumulative.
     */
    @java.lang.Override
    public boolean getCumulative() {
      return cumulative_;
    }
    /**
     *
     *
     * <pre>
     * True if this metric is reported as the total cumulative aggregate
     * value accumulated since the worker started working on this WorkItem.
     * By default this is false, indicating that this metric is reported
     * as a delta that is not associated with any WorkItem.
     * </pre>
     *
     * <code>bool cumulative = 3;</code>
     *
     * @param value The cumulative to set.
     * @return This builder for chaining.
     */
    public Builder setCumulative(boolean value) {

      cumulative_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * True if this metric is reported as the total cumulative aggregate
     * value accumulated since the worker started working on this WorkItem.
     * By default this is false, indicating that this metric is reported
     * as a delta that is not associated with any WorkItem.
     * </pre>
     *
     * <code>bool cumulative = 3;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearCumulative() {

      cumulative_ = false;
      onChanged();
      return this;
    }

    private com.google.protobuf.Value scalar_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        scalarBuilder_;
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
     * "And", and "Or".  The possible value types are Long, Double, and Boolean.
     * </pre>
     *
     * <code>.google.protobuf.Value scalar = 4;</code>
     *
     * @return Whether the scalar field is set.
     */
    public boolean hasScalar() {
      return scalarBuilder_ != null || scalar_ != null;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
     * "And", and "Or".  The possible value types are Long, Double, and Boolean.
     * </pre>
     *
     * <code>.google.protobuf.Value scalar = 4;</code>
     *
     * @return The scalar.
     */
    public com.google.protobuf.Value getScalar() {
      if (scalarBuilder_ == null) {
        return scalar_ == null ? com.google.protobuf.Value.getDefaultInstance() : scalar_;
      } else {
        return scalarBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
     * "And", and "Or".  The possible value types are Long, Double, and Boolean.
     * </pre>
     *
     * <code>.google.protobuf.Value scalar = 4;</code>
     */
    public Builder setScalar(com.google.protobuf.Value value) {
      if (scalarBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        scalar_ = value;
        onChanged();
      } else {
        scalarBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
     * "And", and "Or".  The possible value types are Long, Double, and Boolean.
     * </pre>
     *
     * <code>.google.protobuf.Value scalar = 4;</code>
     */
    public Builder setScalar(com.google.protobuf.Value.Builder builderForValue) {
      if (scalarBuilder_ == null) {
        scalar_ = builderForValue.build();
        onChanged();
      } else {
        scalarBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
     * "And", and "Or".  The possible value types are Long, Double, and Boolean.
     * </pre>
     *
     * <code>.google.protobuf.Value scalar = 4;</code>
     */
    public Builder mergeScalar(com.google.protobuf.Value value) {
      if (scalarBuilder_ == null) {
        if (scalar_ != null) {
          scalar_ = com.google.protobuf.Value.newBuilder(scalar_).mergeFrom(value).buildPartial();
        } else {
          scalar_ = value;
        }
        onChanged();
      } else {
        scalarBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
     * "And", and "Or".  The possible value types are Long, Double, and Boolean.
     * </pre>
     *
     * <code>.google.protobuf.Value scalar = 4;</code>
     */
    public Builder clearScalar() {
      if (scalarBuilder_ == null) {
        scalar_ = null;
        onChanged();
      } else {
        scalar_ = null;
        scalarBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
     * "And", and "Or".  The possible value types are Long, Double, and Boolean.
     * </pre>
     *
     * <code>.google.protobuf.Value scalar = 4;</code>
     */
    public com.google.protobuf.Value.Builder getScalarBuilder() {

      onChanged();
      return getScalarFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
     * "And", and "Or".  The possible value types are Long, Double, and Boolean.
     * </pre>
     *
     * <code>.google.protobuf.Value scalar = 4;</code>
     */
    public com.google.protobuf.ValueOrBuilder getScalarOrBuilder() {
      if (scalarBuilder_ != null) {
        return scalarBuilder_.getMessageOrBuilder();
      } else {
        return scalar_ == null ? com.google.protobuf.Value.getDefaultInstance() : scalar_;
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min",
     * "And", and "Or".  The possible value types are Long, Double, and Boolean.
     * </pre>
     *
     * <code>.google.protobuf.Value scalar = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        getScalarFieldBuilder() {
      if (scalarBuilder_ == null) {
        scalarBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Value,
                com.google.protobuf.Value.Builder,
                com.google.protobuf.ValueOrBuilder>(getScalar(), getParentForChildren(), isClean());
        scalar_ = null;
      }
      return scalarBuilder_;
    }

    private com.google.protobuf.Value meanSum_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        meanSumBuilder_;
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the sum of the aggregated values and is used in combination
     * with mean_count below to obtain the actual mean aggregate value.
     * The only possible value types are Long and Double.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_sum = 5;</code>
     *
     * @return Whether the meanSum field is set.
     */
    public boolean hasMeanSum() {
      return meanSumBuilder_ != null || meanSum_ != null;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the sum of the aggregated values and is used in combination
     * with mean_count below to obtain the actual mean aggregate value.
     * The only possible value types are Long and Double.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_sum = 5;</code>
     *
     * @return The meanSum.
     */
    public com.google.protobuf.Value getMeanSum() {
      if (meanSumBuilder_ == null) {
        return meanSum_ == null ? com.google.protobuf.Value.getDefaultInstance() : meanSum_;
      } else {
        return meanSumBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the sum of the aggregated values and is used in combination
     * with mean_count below to obtain the actual mean aggregate value.
     * The only possible value types are Long and Double.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_sum = 5;</code>
     */
    public Builder setMeanSum(com.google.protobuf.Value value) {
      if (meanSumBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        meanSum_ = value;
        onChanged();
      } else {
        meanSumBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the sum of the aggregated values and is used in combination
     * with mean_count below to obtain the actual mean aggregate value.
     * The only possible value types are Long and Double.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_sum = 5;</code>
     */
    public Builder setMeanSum(com.google.protobuf.Value.Builder builderForValue) {
      if (meanSumBuilder_ == null) {
        meanSum_ = builderForValue.build();
        onChanged();
      } else {
        meanSumBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the sum of the aggregated values and is used in combination
     * with mean_count below to obtain the actual mean aggregate value.
     * The only possible value types are Long and Double.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_sum = 5;</code>
     */
    public Builder mergeMeanSum(com.google.protobuf.Value value) {
      if (meanSumBuilder_ == null) {
        if (meanSum_ != null) {
          meanSum_ = com.google.protobuf.Value.newBuilder(meanSum_).mergeFrom(value).buildPartial();
        } else {
          meanSum_ = value;
        }
        onChanged();
      } else {
        meanSumBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the sum of the aggregated values and is used in combination
     * with mean_count below to obtain the actual mean aggregate value.
     * The only possible value types are Long and Double.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_sum = 5;</code>
     */
    public Builder clearMeanSum() {
      if (meanSumBuilder_ == null) {
        meanSum_ = null;
        onChanged();
      } else {
        meanSum_ = null;
        meanSumBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the sum of the aggregated values and is used in combination
     * with mean_count below to obtain the actual mean aggregate value.
     * The only possible value types are Long and Double.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_sum = 5;</code>
     */
    public com.google.protobuf.Value.Builder getMeanSumBuilder() {

      onChanged();
      return getMeanSumFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the sum of the aggregated values and is used in combination
     * with mean_count below to obtain the actual mean aggregate value.
     * The only possible value types are Long and Double.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_sum = 5;</code>
     */
    public com.google.protobuf.ValueOrBuilder getMeanSumOrBuilder() {
      if (meanSumBuilder_ != null) {
        return meanSumBuilder_.getMessageOrBuilder();
      } else {
        return meanSum_ == null ? com.google.protobuf.Value.getDefaultInstance() : meanSum_;
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the sum of the aggregated values and is used in combination
     * with mean_count below to obtain the actual mean aggregate value.
     * The only possible value types are Long and Double.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_sum = 5;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        getMeanSumFieldBuilder() {
      if (meanSumBuilder_ == null) {
        meanSumBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Value,
                com.google.protobuf.Value.Builder,
                com.google.protobuf.ValueOrBuilder>(
                getMeanSum(), getParentForChildren(), isClean());
        meanSum_ = null;
      }
      return meanSumBuilder_;
    }

    private com.google.protobuf.Value meanCount_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        meanCountBuilder_;
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the count of the aggregated values and is used in combination
     * with mean_sum above to obtain the actual mean aggregate value.
     * The only possible value type is Long.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_count = 6;</code>
     *
     * @return Whether the meanCount field is set.
     */
    public boolean hasMeanCount() {
      return meanCountBuilder_ != null || meanCount_ != null;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the count of the aggregated values and is used in combination
     * with mean_sum above to obtain the actual mean aggregate value.
     * The only possible value type is Long.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_count = 6;</code>
     *
     * @return The meanCount.
     */
    public com.google.protobuf.Value getMeanCount() {
      if (meanCountBuilder_ == null) {
        return meanCount_ == null ? com.google.protobuf.Value.getDefaultInstance() : meanCount_;
      } else {
        return meanCountBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the count of the aggregated values and is used in combination
     * with mean_sum above to obtain the actual mean aggregate value.
     * The only possible value type is Long.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_count = 6;</code>
     */
    public Builder setMeanCount(com.google.protobuf.Value value) {
      if (meanCountBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        meanCount_ = value;
        onChanged();
      } else {
        meanCountBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the count of the aggregated values and is used in combination
     * with mean_sum above to obtain the actual mean aggregate value.
     * The only possible value type is Long.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_count = 6;</code>
     */
    public Builder setMeanCount(com.google.protobuf.Value.Builder builderForValue) {
      if (meanCountBuilder_ == null) {
        meanCount_ = builderForValue.build();
        onChanged();
      } else {
        meanCountBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the count of the aggregated values and is used in combination
     * with mean_sum above to obtain the actual mean aggregate value.
     * The only possible value type is Long.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_count = 6;</code>
     */
    public Builder mergeMeanCount(com.google.protobuf.Value value) {
      if (meanCountBuilder_ == null) {
        if (meanCount_ != null) {
          meanCount_ =
              com.google.protobuf.Value.newBuilder(meanCount_).mergeFrom(value).buildPartial();
        } else {
          meanCount_ = value;
        }
        onChanged();
      } else {
        meanCountBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the count of the aggregated values and is used in combination
     * with mean_sum above to obtain the actual mean aggregate value.
     * The only possible value type is Long.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_count = 6;</code>
     */
    public Builder clearMeanCount() {
      if (meanCountBuilder_ == null) {
        meanCount_ = null;
        onChanged();
      } else {
        meanCount_ = null;
        meanCountBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the count of the aggregated values and is used in combination
     * with mean_sum above to obtain the actual mean aggregate value.
     * The only possible value type is Long.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_count = 6;</code>
     */
    public com.google.protobuf.Value.Builder getMeanCountBuilder() {

      onChanged();
      return getMeanCountFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the count of the aggregated values and is used in combination
     * with mean_sum above to obtain the actual mean aggregate value.
     * The only possible value type is Long.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_count = 6;</code>
     */
    public com.google.protobuf.ValueOrBuilder getMeanCountOrBuilder() {
      if (meanCountBuilder_ != null) {
        return meanCountBuilder_.getMessageOrBuilder();
      } else {
        return meanCount_ == null ? com.google.protobuf.Value.getDefaultInstance() : meanCount_;
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Mean" aggregation kind.
     * This holds the count of the aggregated values and is used in combination
     * with mean_sum above to obtain the actual mean aggregate value.
     * The only possible value type is Long.
     * </pre>
     *
     * <code>.google.protobuf.Value mean_count = 6;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        getMeanCountFieldBuilder() {
      if (meanCountBuilder_ == null) {
        meanCountBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Value,
                com.google.protobuf.Value.Builder,
                com.google.protobuf.ValueOrBuilder>(
                getMeanCount(), getParentForChildren(), isClean());
        meanCount_ = null;
      }
      return meanCountBuilder_;
    }

    private com.google.protobuf.Value set_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        setBuilder_;
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Set" aggregation kind.  The only
     * possible value type is a list of Values whose type can be Long, Double,
     * or String, according to the metric's type.  All Values in the list must
     * be of the same type.
     * </pre>
     *
     * <code>.google.protobuf.Value set = 7;</code>
     *
     * @return Whether the set field is set.
     */
    public boolean hasSet() {
      return setBuilder_ != null || set_ != null;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Set" aggregation kind.  The only
     * possible value type is a list of Values whose type can be Long, Double,
     * or String, according to the metric's type.  All Values in the list must
     * be of the same type.
     * </pre>
     *
     * <code>.google.protobuf.Value set = 7;</code>
     *
     * @return The set.
     */
    public com.google.protobuf.Value getSet() {
      if (setBuilder_ == null) {
        return set_ == null ? com.google.protobuf.Value.getDefaultInstance() : set_;
      } else {
        return setBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Set" aggregation kind.  The only
     * possible value type is a list of Values whose type can be Long, Double,
     * or String, according to the metric's type.  All Values in the list must
     * be of the same type.
     * </pre>
     *
     * <code>.google.protobuf.Value set = 7;</code>
     */
    public Builder setSet(com.google.protobuf.Value value) {
      if (setBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        set_ = value;
        onChanged();
      } else {
        setBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Set" aggregation kind.  The only
     * possible value type is a list of Values whose type can be Long, Double,
     * or String, according to the metric's type.  All Values in the list must
     * be of the same type.
     * </pre>
     *
     * <code>.google.protobuf.Value set = 7;</code>
     */
    public Builder setSet(com.google.protobuf.Value.Builder builderForValue) {
      if (setBuilder_ == null) {
        set_ = builderForValue.build();
        onChanged();
      } else {
        setBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Set" aggregation kind.  The only
     * possible value type is a list of Values whose type can be Long, Double,
     * or String, according to the metric's type.  All Values in the list must
     * be of the same type.
     * </pre>
     *
     * <code>.google.protobuf.Value set = 7;</code>
     */
    public Builder mergeSet(com.google.protobuf.Value value) {
      if (setBuilder_ == null) {
        if (set_ != null) {
          set_ = com.google.protobuf.Value.newBuilder(set_).mergeFrom(value).buildPartial();
        } else {
          set_ = value;
        }
        onChanged();
      } else {
        setBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Set" aggregation kind.  The only
     * possible value type is a list of Values whose type can be Long, Double,
     * or String, according to the metric's type.  All Values in the list must
     * be of the same type.
     * </pre>
     *
     * <code>.google.protobuf.Value set = 7;</code>
     */
    public Builder clearSet() {
      if (setBuilder_ == null) {
        set_ = null;
        onChanged();
      } else {
        set_ = null;
        setBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Set" aggregation kind.  The only
     * possible value type is a list of Values whose type can be Long, Double,
     * or String, according to the metric's type.  All Values in the list must
     * be of the same type.
     * </pre>
     *
     * <code>.google.protobuf.Value set = 7;</code>
     */
    public com.google.protobuf.Value.Builder getSetBuilder() {

      onChanged();
      return getSetFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Set" aggregation kind.  The only
     * possible value type is a list of Values whose type can be Long, Double,
     * or String, according to the metric's type.  All Values in the list must
     * be of the same type.
     * </pre>
     *
     * <code>.google.protobuf.Value set = 7;</code>
     */
    public com.google.protobuf.ValueOrBuilder getSetOrBuilder() {
      if (setBuilder_ != null) {
        return setBuilder_.getMessageOrBuilder();
      } else {
        return set_ == null ? com.google.protobuf.Value.getDefaultInstance() : set_;
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for the "Set" aggregation kind.  The only
     * possible value type is a list of Values whose type can be Long, Double,
     * or String, according to the metric's type.  All Values in the list must
     * be of the same type.
     * </pre>
     *
     * <code>.google.protobuf.Value set = 7;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        getSetFieldBuilder() {
      if (setBuilder_ == null) {
        setBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Value,
                com.google.protobuf.Value.Builder,
                com.google.protobuf.ValueOrBuilder>(getSet(), getParentForChildren(), isClean());
        set_ = null;
      }
      return setBuilder_;
    }

    private com.google.protobuf.Value distribution_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        distributionBuilder_;
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a distribution of numeric values.
     * </pre>
     *
     * <code>.google.protobuf.Value distribution = 11;</code>
     *
     * @return Whether the distribution field is set.
     */
    public boolean hasDistribution() {
      return distributionBuilder_ != null || distribution_ != null;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a distribution of numeric values.
     * </pre>
     *
     * <code>.google.protobuf.Value distribution = 11;</code>
     *
     * @return The distribution.
     */
    public com.google.protobuf.Value getDistribution() {
      if (distributionBuilder_ == null) {
        return distribution_ == null
            ? com.google.protobuf.Value.getDefaultInstance()
            : distribution_;
      } else {
        return distributionBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a distribution of numeric values.
     * </pre>
     *
     * <code>.google.protobuf.Value distribution = 11;</code>
     */
    public Builder setDistribution(com.google.protobuf.Value value) {
      if (distributionBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        distribution_ = value;
        onChanged();
      } else {
        distributionBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a distribution of numeric values.
     * </pre>
     *
     * <code>.google.protobuf.Value distribution = 11;</code>
     */
    public Builder setDistribution(com.google.protobuf.Value.Builder builderForValue) {
      if (distributionBuilder_ == null) {
        distribution_ = builderForValue.build();
        onChanged();
      } else {
        distributionBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a distribution of numeric values.
     * </pre>
     *
     * <code>.google.protobuf.Value distribution = 11;</code>
     */
    public Builder mergeDistribution(com.google.protobuf.Value value) {
      if (distributionBuilder_ == null) {
        if (distribution_ != null) {
          distribution_ =
              com.google.protobuf.Value.newBuilder(distribution_).mergeFrom(value).buildPartial();
        } else {
          distribution_ = value;
        }
        onChanged();
      } else {
        distributionBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a distribution of numeric values.
     * </pre>
     *
     * <code>.google.protobuf.Value distribution = 11;</code>
     */
    public Builder clearDistribution() {
      if (distributionBuilder_ == null) {
        distribution_ = null;
        onChanged();
      } else {
        distribution_ = null;
        distributionBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a distribution of numeric values.
     * </pre>
     *
     * <code>.google.protobuf.Value distribution = 11;</code>
     */
    public com.google.protobuf.Value.Builder getDistributionBuilder() {

      onChanged();
      return getDistributionFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a distribution of numeric values.
     * </pre>
     *
     * <code>.google.protobuf.Value distribution = 11;</code>
     */
    public com.google.protobuf.ValueOrBuilder getDistributionOrBuilder() {
      if (distributionBuilder_ != null) {
        return distributionBuilder_.getMessageOrBuilder();
      } else {
        return distribution_ == null
            ? com.google.protobuf.Value.getDefaultInstance()
            : distribution_;
      }
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a distribution of numeric values.
     * </pre>
     *
     * <code>.google.protobuf.Value distribution = 11;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        getDistributionFieldBuilder() {
      if (distributionBuilder_ == null) {
        distributionBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Value,
                com.google.protobuf.Value.Builder,
                com.google.protobuf.ValueOrBuilder>(
                getDistribution(), getParentForChildren(), isClean());
        distribution_ = null;
      }
      return distributionBuilder_;
    }

    private com.google.protobuf.Value gauge_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        gaugeBuilder_;
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a Gauge.
     * Metrics of gauge type show the value of a metric across time, and is
     * aggregated based on the newest value.
     * </pre>
     *
     * <code>.google.protobuf.Value gauge = 12;</code>
     *
     * @return Whether the gauge field is set.
     */
    public boolean hasGauge() {
      return gaugeBuilder_ != null || gauge_ != null;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a Gauge.
     * Metrics of gauge type show the value of a metric across time, and is
     * aggregated based on the newest value.
     * </pre>
     *
     * <code>.google.protobuf.Value gauge = 12;</code>
     *
     * @return The gauge.
     */
    public com.google.protobuf.Value getGauge() {
      if (gaugeBuilder_ == null) {
        return gauge_ == null ? com.google.protobuf.Value.getDefaultInstance() : gauge_;
      } else {
        return gaugeBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a Gauge.
     * Metrics of gauge type show the value of a metric across time, and is
     * aggregated based on the newest value.
     * </pre>
     *
     * <code>.google.protobuf.Value gauge = 12;</code>
     */
    public Builder setGauge(com.google.protobuf.Value value) {
      if (gaugeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        gauge_ = value;
        onChanged();
      } else {
        gaugeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a Gauge.
     * Metrics of gauge type show the value of a metric across time, and is
     * aggregated based on the newest value.
     * </pre>
     *
     * <code>.google.protobuf.Value gauge = 12;</code>
     */
    public Builder setGauge(com.google.protobuf.Value.Builder builderForValue) {
      if (gaugeBuilder_ == null) {
        gauge_ = builderForValue.build();
        onChanged();
      } else {
        gaugeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a Gauge.
     * Metrics of gauge type show the value of a metric across time, and is
     * aggregated based on the newest value.
     * </pre>
     *
     * <code>.google.protobuf.Value gauge = 12;</code>
     */
    public Builder mergeGauge(com.google.protobuf.Value value) {
      if (gaugeBuilder_ == null) {
        if (gauge_ != null) {
          gauge_ = com.google.protobuf.Value.newBuilder(gauge_).mergeFrom(value).buildPartial();
        } else {
          gauge_ = value;
        }
        onChanged();
      } else {
        gaugeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a Gauge.
     * Metrics of gauge type show the value of a metric across time, and is
     * aggregated based on the newest value.
     * </pre>
     *
     * <code>.google.protobuf.Value gauge = 12;</code>
     */
    public Builder clearGauge() {
      if (gaugeBuilder_ == null) {
        gauge_ = null;
        onChanged();
      } else {
        gauge_ = null;
        gaugeBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a Gauge.
     * Metrics of gauge type show the value of a metric across time, and is
     * aggregated based on the newest value.
     * </pre>
     *
     * <code>.google.protobuf.Value gauge = 12;</code>
     */
    public com.google.protobuf.Value.Builder getGaugeBuilder() {

      onChanged();
      return getGaugeFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a Gauge.
     * Metrics of gauge type show the value of a metric across time, and is
     * aggregated based on the newest value.
     * </pre>
     *
     * <code>.google.protobuf.Value gauge = 12;</code>
     */
    public com.google.protobuf.ValueOrBuilder getGaugeOrBuilder() {
      if (gaugeBuilder_ != null) {
        return gaugeBuilder_.getMessageOrBuilder();
      } else {
        return gauge_ == null ? com.google.protobuf.Value.getDefaultInstance() : gauge_;
      }
    }
    /**
     *
     *
     * <pre>
     * A struct value describing properties of a Gauge.
     * Metrics of gauge type show the value of a metric across time, and is
     * aggregated based on the newest value.
     * </pre>
     *
     * <code>.google.protobuf.Value gauge = 12;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        getGaugeFieldBuilder() {
      if (gaugeBuilder_ == null) {
        gaugeBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Value,
                com.google.protobuf.Value.Builder,
                com.google.protobuf.ValueOrBuilder>(getGauge(), getParentForChildren(), isClean());
        gauge_ = null;
      }
      return gaugeBuilder_;
    }

    private com.google.protobuf.Value internal_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        internalBuilder_;
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for internal use by the Dataflow
     * service.
     * </pre>
     *
     * <code>.google.protobuf.Value internal = 8;</code>
     *
     * @return Whether the internal field is set.
     */
    public boolean hasInternal() {
      return internalBuilder_ != null || internal_ != null;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for internal use by the Dataflow
     * service.
     * </pre>
     *
     * <code>.google.protobuf.Value internal = 8;</code>
     *
     * @return The internal.
     */
    public com.google.protobuf.Value getInternal() {
      if (internalBuilder_ == null) {
        return internal_ == null ? com.google.protobuf.Value.getDefaultInstance() : internal_;
      } else {
        return internalBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for internal use by the Dataflow
     * service.
     * </pre>
     *
     * <code>.google.protobuf.Value internal = 8;</code>
     */
    public Builder setInternal(com.google.protobuf.Value value) {
      if (internalBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        internal_ = value;
        onChanged();
      } else {
        internalBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for internal use by the Dataflow
     * service.
     * </pre>
     *
     * <code>.google.protobuf.Value internal = 8;</code>
     */
    public Builder setInternal(com.google.protobuf.Value.Builder builderForValue) {
      if (internalBuilder_ == null) {
        internal_ = builderForValue.build();
        onChanged();
      } else {
        internalBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for internal use by the Dataflow
     * service.
     * </pre>
     *
     * <code>.google.protobuf.Value internal = 8;</code>
     */
    public Builder mergeInternal(com.google.protobuf.Value value) {
      if (internalBuilder_ == null) {
        if (internal_ != null) {
          internal_ =
              com.google.protobuf.Value.newBuilder(internal_).mergeFrom(value).buildPartial();
        } else {
          internal_ = value;
        }
        onChanged();
      } else {
        internalBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for internal use by the Dataflow
     * service.
     * </pre>
     *
     * <code>.google.protobuf.Value internal = 8;</code>
     */
    public Builder clearInternal() {
      if (internalBuilder_ == null) {
        internal_ = null;
        onChanged();
      } else {
        internal_ = null;
        internalBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for internal use by the Dataflow
     * service.
     * </pre>
     *
     * <code>.google.protobuf.Value internal = 8;</code>
     */
    public com.google.protobuf.Value.Builder getInternalBuilder() {

      onChanged();
      return getInternalFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for internal use by the Dataflow
     * service.
     * </pre>
     *
     * <code>.google.protobuf.Value internal = 8;</code>
     */
    public com.google.protobuf.ValueOrBuilder getInternalOrBuilder() {
      if (internalBuilder_ != null) {
        return internalBuilder_.getMessageOrBuilder();
      } else {
        return internal_ == null ? com.google.protobuf.Value.getDefaultInstance() : internal_;
      }
    }
    /**
     *
     *
     * <pre>
     * Worker-computed aggregate value for internal use by the Dataflow
     * service.
     * </pre>
     *
     * <code>.google.protobuf.Value internal = 8;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Value,
            com.google.protobuf.Value.Builder,
            com.google.protobuf.ValueOrBuilder>
        getInternalFieldBuilder() {
      if (internalBuilder_ == null) {
        internalBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Value,
                com.google.protobuf.Value.Builder,
                com.google.protobuf.ValueOrBuilder>(
                getInternal(), getParentForChildren(), isClean());
        internal_ = null;
      }
      return internalBuilder_;
    }

    private com.google.protobuf.Timestamp updateTime_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        updateTimeBuilder_;
    /**
     *
     *
     * <pre>
     * Timestamp associated with the metric value. Optional when workers are
     * reporting work progress; it will be filled in responses from the
     * metrics API.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 9;</code>
     *
     * @return Whether the updateTime field is set.
     */
    public boolean hasUpdateTime() {
      return updateTimeBuilder_ != null || updateTime_ != null;
    }
    /**
     *
     *
     * <pre>
     * Timestamp associated with the metric value. Optional when workers are
     * reporting work progress; it will be filled in responses from the
     * metrics API.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 9;</code>
     *
     * @return The updateTime.
     */
    public com.google.protobuf.Timestamp getUpdateTime() {
      if (updateTimeBuilder_ == null) {
        return updateTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : updateTime_;
      } else {
        return updateTimeBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Timestamp associated with the metric value. Optional when workers are
     * reporting work progress; it will be filled in responses from the
     * metrics API.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 9;</code>
     */
    public Builder setUpdateTime(com.google.protobuf.Timestamp value) {
      if (updateTimeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        updateTime_ = value;
        onChanged();
      } else {
        updateTimeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Timestamp associated with the metric value. Optional when workers are
     * reporting work progress; it will be filled in responses from the
     * metrics API.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 9;</code>
     */
    public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) {
      if (updateTimeBuilder_ == null) {
        updateTime_ = builderForValue.build();
        onChanged();
      } else {
        updateTimeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Timestamp associated with the metric value. Optional when workers are
     * reporting work progress; it will be filled in responses from the
     * metrics API.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 9;</code>
     */
    public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) {
      if (updateTimeBuilder_ == null) {
        if (updateTime_ != null) {
          updateTime_ =
              com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial();
        } else {
          updateTime_ = value;
        }
        onChanged();
      } else {
        updateTimeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Timestamp associated with the metric value. Optional when workers are
     * reporting work progress; it will be filled in responses from the
     * metrics API.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 9;</code>
     */
    public Builder clearUpdateTime() {
      if (updateTimeBuilder_ == null) {
        updateTime_ = null;
        onChanged();
      } else {
        updateTime_ = null;
        updateTimeBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Timestamp associated with the metric value. Optional when workers are
     * reporting work progress; it will be filled in responses from the
     * metrics API.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 9;</code>
     */
    public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() {

      onChanged();
      return getUpdateTimeFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Timestamp associated with the metric value. Optional when workers are
     * reporting work progress; it will be filled in responses from the
     * metrics API.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 9;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() {
      if (updateTimeBuilder_ != null) {
        return updateTimeBuilder_.getMessageOrBuilder();
      } else {
        return updateTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : updateTime_;
      }
    }
    /**
     *
     *
     * <pre>
     * Timestamp associated with the metric value. Optional when workers are
     * reporting work progress; it will be filled in responses from the
     * metrics API.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 9;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        getUpdateTimeFieldBuilder() {
      if (updateTimeBuilder_ == null) {
        updateTimeBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Timestamp,
                com.google.protobuf.Timestamp.Builder,
                com.google.protobuf.TimestampOrBuilder>(
                getUpdateTime(), getParentForChildren(), isClean());
        updateTime_ = null;
      }
      return updateTimeBuilder_;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

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

    // @@protoc_insertion_point(builder_scope:google.dataflow.v1beta3.MetricUpdate)
  }

  // @@protoc_insertion_point(class_scope:google.dataflow.v1beta3.MetricUpdate)
  private static final com.google.dataflow.v1beta3.MetricUpdate DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.dataflow.v1beta3.MetricUpdate();
  }

  public static com.google.dataflow.v1beta3.MetricUpdate getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.dataflow.v1beta3.MetricUpdate getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
