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

package com.google.cloud.dataproc.v1;

/**
 *
 *
 * <pre>
 * Specifies the selection and config of software inside the cluster.
 * </pre>
 *
 * Protobuf type {@code google.cloud.dataproc.v1.SoftwareConfig}
 */
public final class SoftwareConfig extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.dataproc.v1.SoftwareConfig)
    SoftwareConfigOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use SoftwareConfig.newBuilder() to construct.
  private SoftwareConfig(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private SoftwareConfig() {
    imageVersion_ = "";
    optionalComponents_ = java.util.Collections.emptyList();
  }

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

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

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.dataproc.v1.ClustersProto
        .internal_static_google_cloud_dataproc_v1_SoftwareConfig_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  @java.lang.Override
  protected com.google.protobuf.MapField internalGetMapField(int number) {
    switch (number) {
      case 2:
        return internalGetProperties();
      default:
        throw new RuntimeException("Invalid map field number: " + number);
    }
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.dataproc.v1.ClustersProto
        .internal_static_google_cloud_dataproc_v1_SoftwareConfig_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.dataproc.v1.SoftwareConfig.class,
            com.google.cloud.dataproc.v1.SoftwareConfig.Builder.class);
  }

  public static final int IMAGE_VERSION_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private volatile java.lang.Object imageVersion_ = "";
  /**
   *
   *
   * <pre>
   * Optional. The version of software inside the cluster. It must be one of the
   * supported [Dataproc
   * Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions),
   * such as "1.2" (including a subminor version, such as "1.2.29"), or the
   * ["preview"
   * version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
   * If unspecified, it defaults to the latest Debian version.
   * </pre>
   *
   * <code>string image_version = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The imageVersion.
   */
  @java.lang.Override
  public java.lang.String getImageVersion() {
    java.lang.Object ref = imageVersion_;
    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();
      imageVersion_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Optional. The version of software inside the cluster. It must be one of the
   * supported [Dataproc
   * Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions),
   * such as "1.2" (including a subminor version, such as "1.2.29"), or the
   * ["preview"
   * version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
   * If unspecified, it defaults to the latest Debian version.
   * </pre>
   *
   * <code>string image_version = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The bytes for imageVersion.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getImageVersionBytes() {
    java.lang.Object ref = imageVersion_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      imageVersion_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int PROPERTIES_FIELD_NUMBER = 2;

  private static final class PropertiesDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry =
        com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance(
            com.google.cloud.dataproc.v1.ClustersProto
                .internal_static_google_cloud_dataproc_v1_SoftwareConfig_PropertiesEntry_descriptor,
            com.google.protobuf.WireFormat.FieldType.STRING,
            "",
            com.google.protobuf.WireFormat.FieldType.STRING,
            "");
  }

  @SuppressWarnings("serial")
  private com.google.protobuf.MapField<java.lang.String, java.lang.String> properties_;

  private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetProperties() {
    if (properties_ == null) {
      return com.google.protobuf.MapField.emptyMapField(PropertiesDefaultEntryHolder.defaultEntry);
    }
    return properties_;
  }

  public int getPropertiesCount() {
    return internalGetProperties().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * Optional. The properties to set on daemon config files.
   * Property keys are specified in `prefix:property` format, for example
   * `core:hadoop.tmp.dir`. The following are supported prefixes
   * and their mappings:
   * * capacity-scheduler: `capacity-scheduler.xml`
   * * core:   `core-site.xml`
   * * distcp: `distcp-default.xml`
   * * hdfs:   `hdfs-site.xml`
   * * hive:   `hive-site.xml`
   * * mapred: `mapred-site.xml`
   * * pig:    `pig.properties`
   * * spark:  `spark-defaults.conf`
   * * yarn:   `yarn-site.xml`
   * For more information, see [Cluster
   * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
   * </pre>
   *
   * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public boolean containsProperties(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    return internalGetProperties().getMap().containsKey(key);
  }
  /** Use {@link #getPropertiesMap()} instead. */
  @java.lang.Override
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getProperties() {
    return getPropertiesMap();
  }
  /**
   *
   *
   * <pre>
   * Optional. The properties to set on daemon config files.
   * Property keys are specified in `prefix:property` format, for example
   * `core:hadoop.tmp.dir`. The following are supported prefixes
   * and their mappings:
   * * capacity-scheduler: `capacity-scheduler.xml`
   * * core:   `core-site.xml`
   * * distcp: `distcp-default.xml`
   * * hdfs:   `hdfs-site.xml`
   * * hive:   `hive-site.xml`
   * * mapred: `mapred-site.xml`
   * * pig:    `pig.properties`
   * * spark:  `spark-defaults.conf`
   * * yarn:   `yarn-site.xml`
   * For more information, see [Cluster
   * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
   * </pre>
   *
   * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public java.util.Map<java.lang.String, java.lang.String> getPropertiesMap() {
    return internalGetProperties().getMap();
  }
  /**
   *
   *
   * <pre>
   * Optional. The properties to set on daemon config files.
   * Property keys are specified in `prefix:property` format, for example
   * `core:hadoop.tmp.dir`. The following are supported prefixes
   * and their mappings:
   * * capacity-scheduler: `capacity-scheduler.xml`
   * * core:   `core-site.xml`
   * * distcp: `distcp-default.xml`
   * * hdfs:   `hdfs-site.xml`
   * * hive:   `hive-site.xml`
   * * mapred: `mapred-site.xml`
   * * pig:    `pig.properties`
   * * spark:  `spark-defaults.conf`
   * * yarn:   `yarn-site.xml`
   * For more information, see [Cluster
   * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
   * </pre>
   *
   * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public /* nullable */ java.lang.String getPropertiesOrDefault(
      java.lang.String key,
      /* nullable */
      java.lang.String defaultValue) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetProperties().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * Optional. The properties to set on daemon config files.
   * Property keys are specified in `prefix:property` format, for example
   * `core:hadoop.tmp.dir`. The following are supported prefixes
   * and their mappings:
   * * capacity-scheduler: `capacity-scheduler.xml`
   * * core:   `core-site.xml`
   * * distcp: `distcp-default.xml`
   * * hdfs:   `hdfs-site.xml`
   * * hive:   `hive-site.xml`
   * * mapred: `mapred-site.xml`
   * * pig:    `pig.properties`
   * * spark:  `spark-defaults.conf`
   * * yarn:   `yarn-site.xml`
   * For more information, see [Cluster
   * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
   * </pre>
   *
   * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public java.lang.String getPropertiesOrThrow(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetProperties().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int OPTIONAL_COMPONENTS_FIELD_NUMBER = 3;

  @SuppressWarnings("serial")
  private java.util.List<java.lang.Integer> optionalComponents_;

  private static final com.google.protobuf.Internal.ListAdapter.Converter<
          java.lang.Integer, com.google.cloud.dataproc.v1.Component>
      optionalComponents_converter_ =
          new com.google.protobuf.Internal.ListAdapter.Converter<
              java.lang.Integer, com.google.cloud.dataproc.v1.Component>() {
            public com.google.cloud.dataproc.v1.Component convert(java.lang.Integer from) {
              com.google.cloud.dataproc.v1.Component result =
                  com.google.cloud.dataproc.v1.Component.forNumber(from);
              return result == null ? com.google.cloud.dataproc.v1.Component.UNRECOGNIZED : result;
            }
          };
  /**
   *
   *
   * <pre>
   * Optional. The set of components to activate on the cluster.
   * </pre>
   *
   * <code>
   * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return A list containing the optionalComponents.
   */
  @java.lang.Override
  public java.util.List<com.google.cloud.dataproc.v1.Component> getOptionalComponentsList() {
    return new com.google.protobuf.Internal.ListAdapter<
        java.lang.Integer, com.google.cloud.dataproc.v1.Component>(
        optionalComponents_, optionalComponents_converter_);
  }
  /**
   *
   *
   * <pre>
   * Optional. The set of components to activate on the cluster.
   * </pre>
   *
   * <code>
   * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return The count of optionalComponents.
   */
  @java.lang.Override
  public int getOptionalComponentsCount() {
    return optionalComponents_.size();
  }
  /**
   *
   *
   * <pre>
   * Optional. The set of components to activate on the cluster.
   * </pre>
   *
   * <code>
   * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @param index The index of the element to return.
   * @return The optionalComponents at the given index.
   */
  @java.lang.Override
  public com.google.cloud.dataproc.v1.Component getOptionalComponents(int index) {
    return optionalComponents_converter_.convert(optionalComponents_.get(index));
  }
  /**
   *
   *
   * <pre>
   * Optional. The set of components to activate on the cluster.
   * </pre>
   *
   * <code>
   * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return A list containing the enum numeric values on the wire for optionalComponents.
   */
  @java.lang.Override
  public java.util.List<java.lang.Integer> getOptionalComponentsValueList() {
    return optionalComponents_;
  }
  /**
   *
   *
   * <pre>
   * Optional. The set of components to activate on the cluster.
   * </pre>
   *
   * <code>
   * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @param index The index of the value to return.
   * @return The enum numeric value on the wire of optionalComponents at the given index.
   */
  @java.lang.Override
  public int getOptionalComponentsValue(int index) {
    return optionalComponents_.get(index);
  }

  private int optionalComponentsMemoizedSerializedSize;

  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 {
    getSerializedSize();
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(imageVersion_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, imageVersion_);
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetProperties(), PropertiesDefaultEntryHolder.defaultEntry, 2);
    if (getOptionalComponentsList().size() > 0) {
      output.writeUInt32NoTag(26);
      output.writeUInt32NoTag(optionalComponentsMemoizedSerializedSize);
    }
    for (int i = 0; i < optionalComponents_.size(); i++) {
      output.writeEnumNoTag(optionalComponents_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(imageVersion_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, imageVersion_);
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry :
        internalGetProperties().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String> properties__ =
          PropertiesDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, properties__);
    }
    {
      int dataSize = 0;
      for (int i = 0; i < optionalComponents_.size(); i++) {
        dataSize +=
            com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(optionalComponents_.get(i));
      }
      size += dataSize;
      if (!getOptionalComponentsList().isEmpty()) {
        size += 1;
        size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize);
      }
      optionalComponentsMemoizedSerializedSize = dataSize;
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.dataproc.v1.SoftwareConfig)) {
      return super.equals(obj);
    }
    com.google.cloud.dataproc.v1.SoftwareConfig other =
        (com.google.cloud.dataproc.v1.SoftwareConfig) obj;

    if (!getImageVersion().equals(other.getImageVersion())) return false;
    if (!internalGetProperties().equals(other.internalGetProperties())) return false;
    if (!optionalComponents_.equals(other.optionalComponents_)) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + IMAGE_VERSION_FIELD_NUMBER;
    hash = (53 * hash) + getImageVersion().hashCode();
    if (!internalGetProperties().getMap().isEmpty()) {
      hash = (37 * hash) + PROPERTIES_FIELD_NUMBER;
      hash = (53 * hash) + internalGetProperties().hashCode();
    }
    if (getOptionalComponentsCount() > 0) {
      hash = (37 * hash) + OPTIONAL_COMPONENTS_FIELD_NUMBER;
      hash = (53 * hash) + optionalComponents_.hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

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

  public static com.google.cloud.dataproc.v1.SoftwareConfig parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.dataproc.v1.SoftwareConfig parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

  public static com.google.cloud.dataproc.v1.SoftwareConfig parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.dataproc.v1.SoftwareConfig parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

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

  public static com.google.cloud.dataproc.v1.SoftwareConfig parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

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

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

  public static Builder newBuilder(com.google.cloud.dataproc.v1.SoftwareConfig 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>
   * Specifies the selection and config of software inside the cluster.
   * </pre>
   *
   * Protobuf type {@code google.cloud.dataproc.v1.SoftwareConfig}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.dataproc.v1.SoftwareConfig)
      com.google.cloud.dataproc.v1.SoftwareConfigOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.dataproc.v1.ClustersProto
          .internal_static_google_cloud_dataproc_v1_SoftwareConfig_descriptor;
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMapField(int number) {
      switch (number) {
        case 2:
          return internalGetProperties();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMutableMapField(int number) {
      switch (number) {
        case 2:
          return internalGetMutableProperties();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.dataproc.v1.ClustersProto
          .internal_static_google_cloud_dataproc_v1_SoftwareConfig_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.dataproc.v1.SoftwareConfig.class,
              com.google.cloud.dataproc.v1.SoftwareConfig.Builder.class);
    }

    // Construct using com.google.cloud.dataproc.v1.SoftwareConfig.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      imageVersion_ = "";
      internalGetMutableProperties().clear();
      optionalComponents_ = java.util.Collections.emptyList();
      bitField0_ = (bitField0_ & ~0x00000004);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.dataproc.v1.ClustersProto
          .internal_static_google_cloud_dataproc_v1_SoftwareConfig_descriptor;
    }

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

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

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

    private void buildPartialRepeatedFields(com.google.cloud.dataproc.v1.SoftwareConfig result) {
      if (((bitField0_ & 0x00000004) != 0)) {
        optionalComponents_ = java.util.Collections.unmodifiableList(optionalComponents_);
        bitField0_ = (bitField0_ & ~0x00000004);
      }
      result.optionalComponents_ = optionalComponents_;
    }

    private void buildPartial0(com.google.cloud.dataproc.v1.SoftwareConfig result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.imageVersion_ = imageVersion_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.properties_ = internalGetProperties();
        result.properties_.makeImmutable();
      }
    }

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

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

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

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

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

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

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.dataproc.v1.SoftwareConfig) {
        return mergeFrom((com.google.cloud.dataproc.v1.SoftwareConfig) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.dataproc.v1.SoftwareConfig other) {
      if (other == com.google.cloud.dataproc.v1.SoftwareConfig.getDefaultInstance()) return this;
      if (!other.getImageVersion().isEmpty()) {
        imageVersion_ = other.imageVersion_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      internalGetMutableProperties().mergeFrom(other.internalGetProperties());
      bitField0_ |= 0x00000002;
      if (!other.optionalComponents_.isEmpty()) {
        if (optionalComponents_.isEmpty()) {
          optionalComponents_ = other.optionalComponents_;
          bitField0_ = (bitField0_ & ~0x00000004);
        } else {
          ensureOptionalComponentsIsMutable();
          optionalComponents_.addAll(other.optionalComponents_);
        }
        onChanged();
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                imageVersion_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                com.google.protobuf.MapEntry<java.lang.String, java.lang.String> properties__ =
                    input.readMessage(
                        PropertiesDefaultEntryHolder.defaultEntry.getParserForType(),
                        extensionRegistry);
                internalGetMutableProperties()
                    .getMutableMap()
                    .put(properties__.getKey(), properties__.getValue());
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 24:
              {
                int tmpRaw = input.readEnum();
                ensureOptionalComponentsIsMutable();
                optionalComponents_.add(tmpRaw);
                break;
              } // case 24
            case 26:
              {
                int length = input.readRawVarint32();
                int oldLimit = input.pushLimit(length);
                while (input.getBytesUntilLimit() > 0) {
                  int tmpRaw = input.readEnum();
                  ensureOptionalComponentsIsMutable();
                  optionalComponents_.add(tmpRaw);
                }
                input.popLimit(oldLimit);
                break;
              } // case 26
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private java.lang.Object imageVersion_ = "";
    /**
     *
     *
     * <pre>
     * Optional. The version of software inside the cluster. It must be one of the
     * supported [Dataproc
     * Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions),
     * such as "1.2" (including a subminor version, such as "1.2.29"), or the
     * ["preview"
     * version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
     * If unspecified, it defaults to the latest Debian version.
     * </pre>
     *
     * <code>string image_version = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The imageVersion.
     */
    public java.lang.String getImageVersion() {
      java.lang.Object ref = imageVersion_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        imageVersion_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. The version of software inside the cluster. It must be one of the
     * supported [Dataproc
     * Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions),
     * such as "1.2" (including a subminor version, such as "1.2.29"), or the
     * ["preview"
     * version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
     * If unspecified, it defaults to the latest Debian version.
     * </pre>
     *
     * <code>string image_version = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The bytes for imageVersion.
     */
    public com.google.protobuf.ByteString getImageVersionBytes() {
      java.lang.Object ref = imageVersion_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        imageVersion_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. The version of software inside the cluster. It must be one of the
     * supported [Dataproc
     * Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions),
     * such as "1.2" (including a subminor version, such as "1.2.29"), or the
     * ["preview"
     * version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
     * If unspecified, it defaults to the latest Debian version.
     * </pre>
     *
     * <code>string image_version = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The imageVersion to set.
     * @return This builder for chaining.
     */
    public Builder setImageVersion(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      imageVersion_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The version of software inside the cluster. It must be one of the
     * supported [Dataproc
     * Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions),
     * such as "1.2" (including a subminor version, such as "1.2.29"), or the
     * ["preview"
     * version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
     * If unspecified, it defaults to the latest Debian version.
     * </pre>
     *
     * <code>string image_version = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearImageVersion() {
      imageVersion_ = getDefaultInstance().getImageVersion();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The version of software inside the cluster. It must be one of the
     * supported [Dataproc
     * Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions),
     * such as "1.2" (including a subminor version, such as "1.2.29"), or the
     * ["preview"
     * version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
     * If unspecified, it defaults to the latest Debian version.
     * </pre>
     *
     * <code>string image_version = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The bytes for imageVersion to set.
     * @return This builder for chaining.
     */
    public Builder setImageVersionBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      imageVersion_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> properties_;

    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
        internalGetProperties() {
      if (properties_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            PropertiesDefaultEntryHolder.defaultEntry);
      }
      return properties_;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
        internalGetMutableProperties() {
      if (properties_ == null) {
        properties_ =
            com.google.protobuf.MapField.newMapField(PropertiesDefaultEntryHolder.defaultEntry);
      }
      if (!properties_.isMutable()) {
        properties_ = properties_.copy();
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return properties_;
    }

    public int getPropertiesCount() {
      return internalGetProperties().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * Optional. The properties to set on daemon config files.
     * Property keys are specified in `prefix:property` format, for example
     * `core:hadoop.tmp.dir`. The following are supported prefixes
     * and their mappings:
     * * capacity-scheduler: `capacity-scheduler.xml`
     * * core:   `core-site.xml`
     * * distcp: `distcp-default.xml`
     * * hdfs:   `hdfs-site.xml`
     * * hive:   `hive-site.xml`
     * * mapred: `mapred-site.xml`
     * * pig:    `pig.properties`
     * * spark:  `spark-defaults.conf`
     * * yarn:   `yarn-site.xml`
     * For more information, see [Cluster
     * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
     * </pre>
     *
     * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public boolean containsProperties(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      return internalGetProperties().getMap().containsKey(key);
    }
    /** Use {@link #getPropertiesMap()} instead. */
    @java.lang.Override
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getProperties() {
      return getPropertiesMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. The properties to set on daemon config files.
     * Property keys are specified in `prefix:property` format, for example
     * `core:hadoop.tmp.dir`. The following are supported prefixes
     * and their mappings:
     * * capacity-scheduler: `capacity-scheduler.xml`
     * * core:   `core-site.xml`
     * * distcp: `distcp-default.xml`
     * * hdfs:   `hdfs-site.xml`
     * * hive:   `hive-site.xml`
     * * mapred: `mapred-site.xml`
     * * pig:    `pig.properties`
     * * spark:  `spark-defaults.conf`
     * * yarn:   `yarn-site.xml`
     * For more information, see [Cluster
     * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
     * </pre>
     *
     * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public java.util.Map<java.lang.String, java.lang.String> getPropertiesMap() {
      return internalGetProperties().getMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. The properties to set on daemon config files.
     * Property keys are specified in `prefix:property` format, for example
     * `core:hadoop.tmp.dir`. The following are supported prefixes
     * and their mappings:
     * * capacity-scheduler: `capacity-scheduler.xml`
     * * core:   `core-site.xml`
     * * distcp: `distcp-default.xml`
     * * hdfs:   `hdfs-site.xml`
     * * hive:   `hive-site.xml`
     * * mapred: `mapred-site.xml`
     * * pig:    `pig.properties`
     * * spark:  `spark-defaults.conf`
     * * yarn:   `yarn-site.xml`
     * For more information, see [Cluster
     * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
     * </pre>
     *
     * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public /* nullable */ java.lang.String getPropertiesOrDefault(
        java.lang.String key,
        /* nullable */
        java.lang.String defaultValue) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetProperties().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * Optional. The properties to set on daemon config files.
     * Property keys are specified in `prefix:property` format, for example
     * `core:hadoop.tmp.dir`. The following are supported prefixes
     * and their mappings:
     * * capacity-scheduler: `capacity-scheduler.xml`
     * * core:   `core-site.xml`
     * * distcp: `distcp-default.xml`
     * * hdfs:   `hdfs-site.xml`
     * * hive:   `hive-site.xml`
     * * mapred: `mapred-site.xml`
     * * pig:    `pig.properties`
     * * spark:  `spark-defaults.conf`
     * * yarn:   `yarn-site.xml`
     * For more information, see [Cluster
     * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
     * </pre>
     *
     * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public java.lang.String getPropertiesOrThrow(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetProperties().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearProperties() {
      bitField0_ = (bitField0_ & ~0x00000002);
      internalGetMutableProperties().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The properties to set on daemon config files.
     * Property keys are specified in `prefix:property` format, for example
     * `core:hadoop.tmp.dir`. The following are supported prefixes
     * and their mappings:
     * * capacity-scheduler: `capacity-scheduler.xml`
     * * core:   `core-site.xml`
     * * distcp: `distcp-default.xml`
     * * hdfs:   `hdfs-site.xml`
     * * hive:   `hive-site.xml`
     * * mapred: `mapred-site.xml`
     * * pig:    `pig.properties`
     * * spark:  `spark-defaults.conf`
     * * yarn:   `yarn-site.xml`
     * For more information, see [Cluster
     * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
     * </pre>
     *
     * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder removeProperties(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      internalGetMutableProperties().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getMutableProperties() {
      bitField0_ |= 0x00000002;
      return internalGetMutableProperties().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. The properties to set on daemon config files.
     * Property keys are specified in `prefix:property` format, for example
     * `core:hadoop.tmp.dir`. The following are supported prefixes
     * and their mappings:
     * * capacity-scheduler: `capacity-scheduler.xml`
     * * core:   `core-site.xml`
     * * distcp: `distcp-default.xml`
     * * hdfs:   `hdfs-site.xml`
     * * hive:   `hive-site.xml`
     * * mapred: `mapred-site.xml`
     * * pig:    `pig.properties`
     * * spark:  `spark-defaults.conf`
     * * yarn:   `yarn-site.xml`
     * For more information, see [Cluster
     * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
     * </pre>
     *
     * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder putProperties(java.lang.String key, java.lang.String value) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      if (value == null) {
        throw new NullPointerException("map value");
      }
      internalGetMutableProperties().getMutableMap().put(key, value);
      bitField0_ |= 0x00000002;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The properties to set on daemon config files.
     * Property keys are specified in `prefix:property` format, for example
     * `core:hadoop.tmp.dir`. The following are supported prefixes
     * and their mappings:
     * * capacity-scheduler: `capacity-scheduler.xml`
     * * core:   `core-site.xml`
     * * distcp: `distcp-default.xml`
     * * hdfs:   `hdfs-site.xml`
     * * hive:   `hive-site.xml`
     * * mapred: `mapred-site.xml`
     * * pig:    `pig.properties`
     * * spark:  `spark-defaults.conf`
     * * yarn:   `yarn-site.xml`
     * For more information, see [Cluster
     * properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
     * </pre>
     *
     * <code>map&lt;string, string&gt; properties = 2 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder putAllProperties(java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableProperties().getMutableMap().putAll(values);
      bitField0_ |= 0x00000002;
      return this;
    }

    private java.util.List<java.lang.Integer> optionalComponents_ =
        java.util.Collections.emptyList();

    private void ensureOptionalComponentsIsMutable() {
      if (!((bitField0_ & 0x00000004) != 0)) {
        optionalComponents_ = new java.util.ArrayList<java.lang.Integer>(optionalComponents_);
        bitField0_ |= 0x00000004;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return A list containing the optionalComponents.
     */
    public java.util.List<com.google.cloud.dataproc.v1.Component> getOptionalComponentsList() {
      return new com.google.protobuf.Internal.ListAdapter<
          java.lang.Integer, com.google.cloud.dataproc.v1.Component>(
          optionalComponents_, optionalComponents_converter_);
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The count of optionalComponents.
     */
    public int getOptionalComponentsCount() {
      return optionalComponents_.size();
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param index The index of the element to return.
     * @return The optionalComponents at the given index.
     */
    public com.google.cloud.dataproc.v1.Component getOptionalComponents(int index) {
      return optionalComponents_converter_.convert(optionalComponents_.get(index));
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param index The index to set the value at.
     * @param value The optionalComponents to set.
     * @return This builder for chaining.
     */
    public Builder setOptionalComponents(int index, com.google.cloud.dataproc.v1.Component value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureOptionalComponentsIsMutable();
      optionalComponents_.set(index, value.getNumber());
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param value The optionalComponents to add.
     * @return This builder for chaining.
     */
    public Builder addOptionalComponents(com.google.cloud.dataproc.v1.Component value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureOptionalComponentsIsMutable();
      optionalComponents_.add(value.getNumber());
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param values The optionalComponents to add.
     * @return This builder for chaining.
     */
    public Builder addAllOptionalComponents(
        java.lang.Iterable<? extends com.google.cloud.dataproc.v1.Component> values) {
      ensureOptionalComponentsIsMutable();
      for (com.google.cloud.dataproc.v1.Component value : values) {
        optionalComponents_.add(value.getNumber());
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return This builder for chaining.
     */
    public Builder clearOptionalComponents() {
      optionalComponents_ = java.util.Collections.emptyList();
      bitField0_ = (bitField0_ & ~0x00000004);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return A list containing the enum numeric values on the wire for optionalComponents.
     */
    public java.util.List<java.lang.Integer> getOptionalComponentsValueList() {
      return java.util.Collections.unmodifiableList(optionalComponents_);
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param index The index of the value to return.
     * @return The enum numeric value on the wire of optionalComponents at the given index.
     */
    public int getOptionalComponentsValue(int index) {
      return optionalComponents_.get(index);
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param index The index to set the value at.
     * @param value The enum numeric value on the wire for optionalComponents to set.
     * @return This builder for chaining.
     */
    public Builder setOptionalComponentsValue(int index, int value) {
      ensureOptionalComponentsIsMutable();
      optionalComponents_.set(index, value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param value The enum numeric value on the wire for optionalComponents to add.
     * @return This builder for chaining.
     */
    public Builder addOptionalComponentsValue(int value) {
      ensureOptionalComponentsIsMutable();
      optionalComponents_.add(value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The set of components to activate on the cluster.
     * </pre>
     *
     * <code>
     * repeated .google.cloud.dataproc.v1.Component optional_components = 3 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param values The enum numeric values on the wire for optionalComponents to add.
     * @return This builder for chaining.
     */
    public Builder addAllOptionalComponentsValue(java.lang.Iterable<java.lang.Integer> values) {
      ensureOptionalComponentsIsMutable();
      for (int value : values) {
        optionalComponents_.add(value);
      }
      onChanged();
      return this;
    }

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

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

    // @@protoc_insertion_point(builder_scope:google.cloud.dataproc.v1.SoftwareConfig)
  }

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

  static {
    DEFAULT_INSTANCE = new com.google.cloud.dataproc.v1.SoftwareConfig();
  }

  public static com.google.cloud.dataproc.v1.SoftwareConfig getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<SoftwareConfig> PARSER =
      new com.google.protobuf.AbstractParser<SoftwareConfig>() {
        @java.lang.Override
        public SoftwareConfig parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

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

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

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