Source.java

/*
 * Copyright 2019 The Grafeas Authors. All rights reserved.
 *
 * 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: grafeas/v1/provenance.proto

package io.grafeas.v1;

/**
 *
 *
 * <pre>
 * Source describes the location of the source used for the build.
 * </pre>
 *
 * Protobuf type {@code grafeas.v1.Source}
 */
public final class Source extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:grafeas.v1.Source)
    SourceOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use Source.newBuilder() to construct.
  private Source(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private Source() {
    artifactStorageSourceUri_ = "";
    additionalContexts_ = java.util.Collections.emptyList();
  }

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

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

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return io.grafeas.v1.Provenance.internal_static_grafeas_v1_Source_descriptor;
  }

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

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return io.grafeas.v1.Provenance.internal_static_grafeas_v1_Source_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            io.grafeas.v1.Source.class, io.grafeas.v1.Source.Builder.class);
  }

  public static final int ARTIFACT_STORAGE_SOURCE_URI_FIELD_NUMBER = 1;
  private volatile java.lang.Object artifactStorageSourceUri_;
  /**
   *
   *
   * <pre>
   * If provided, the input binary artifacts for the build came from this
   * location.
   * </pre>
   *
   * <code>string artifact_storage_source_uri = 1;</code>
   *
   * @return The artifactStorageSourceUri.
   */
  @java.lang.Override
  public java.lang.String getArtifactStorageSourceUri() {
    java.lang.Object ref = artifactStorageSourceUri_;
    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();
      artifactStorageSourceUri_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * If provided, the input binary artifacts for the build came from this
   * location.
   * </pre>
   *
   * <code>string artifact_storage_source_uri = 1;</code>
   *
   * @return The bytes for artifactStorageSourceUri.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getArtifactStorageSourceUriBytes() {
    java.lang.Object ref = artifactStorageSourceUri_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      artifactStorageSourceUri_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int FILE_HASHES_FIELD_NUMBER = 2;

  private static final class FileHashesDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<java.lang.String, io.grafeas.v1.FileHashes>
        defaultEntry =
            com.google.protobuf.MapEntry
                .<java.lang.String, io.grafeas.v1.FileHashes>newDefaultInstance(
                    io.grafeas.v1.Provenance
                        .internal_static_grafeas_v1_Source_FileHashesEntry_descriptor,
                    com.google.protobuf.WireFormat.FieldType.STRING,
                    "",
                    com.google.protobuf.WireFormat.FieldType.MESSAGE,
                    io.grafeas.v1.FileHashes.getDefaultInstance());
  }

  private com.google.protobuf.MapField<java.lang.String, io.grafeas.v1.FileHashes> fileHashes_;

  private com.google.protobuf.MapField<java.lang.String, io.grafeas.v1.FileHashes>
      internalGetFileHashes() {
    if (fileHashes_ == null) {
      return com.google.protobuf.MapField.emptyMapField(FileHashesDefaultEntryHolder.defaultEntry);
    }
    return fileHashes_;
  }

  public int getFileHashesCount() {
    return internalGetFileHashes().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * Hash(es) of the build source, which can be used to verify that the original
   * source integrity was maintained in the build.
   * The keys to this map are file paths used as build source and the values
   * contain the hash values for those files.
   * If the build source came in a single package such as a gzipped tarfile
   * (.tar.gz), the FileHash will be for the single path to that file.
   * </pre>
   *
   * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
   */
  @java.lang.Override
  public boolean containsFileHashes(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    return internalGetFileHashes().getMap().containsKey(key);
  }
  /** Use {@link #getFileHashesMap()} instead. */
  @java.lang.Override
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> getFileHashes() {
    return getFileHashesMap();
  }
  /**
   *
   *
   * <pre>
   * Hash(es) of the build source, which can be used to verify that the original
   * source integrity was maintained in the build.
   * The keys to this map are file paths used as build source and the values
   * contain the hash values for those files.
   * If the build source came in a single package such as a gzipped tarfile
   * (.tar.gz), the FileHash will be for the single path to that file.
   * </pre>
   *
   * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
   */
  @java.lang.Override
  public java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> getFileHashesMap() {
    return internalGetFileHashes().getMap();
  }
  /**
   *
   *
   * <pre>
   * Hash(es) of the build source, which can be used to verify that the original
   * source integrity was maintained in the build.
   * The keys to this map are file paths used as build source and the values
   * contain the hash values for those files.
   * If the build source came in a single package such as a gzipped tarfile
   * (.tar.gz), the FileHash will be for the single path to that file.
   * </pre>
   *
   * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
   */
  @java.lang.Override
  public io.grafeas.v1.FileHashes getFileHashesOrDefault(
      java.lang.String key, io.grafeas.v1.FileHashes defaultValue) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> map =
        internalGetFileHashes().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * Hash(es) of the build source, which can be used to verify that the original
   * source integrity was maintained in the build.
   * The keys to this map are file paths used as build source and the values
   * contain the hash values for those files.
   * If the build source came in a single package such as a gzipped tarfile
   * (.tar.gz), the FileHash will be for the single path to that file.
   * </pre>
   *
   * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
   */
  @java.lang.Override
  public io.grafeas.v1.FileHashes getFileHashesOrThrow(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> map =
        internalGetFileHashes().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int CONTEXT_FIELD_NUMBER = 3;
  private io.grafeas.v1.SourceContext context_;
  /**
   *
   *
   * <pre>
   * If provided, the source code used for the build came from this location.
   * </pre>
   *
   * <code>.grafeas.v1.SourceContext context = 3;</code>
   *
   * @return Whether the context field is set.
   */
  @java.lang.Override
  public boolean hasContext() {
    return context_ != null;
  }
  /**
   *
   *
   * <pre>
   * If provided, the source code used for the build came from this location.
   * </pre>
   *
   * <code>.grafeas.v1.SourceContext context = 3;</code>
   *
   * @return The context.
   */
  @java.lang.Override
  public io.grafeas.v1.SourceContext getContext() {
    return context_ == null ? io.grafeas.v1.SourceContext.getDefaultInstance() : context_;
  }
  /**
   *
   *
   * <pre>
   * If provided, the source code used for the build came from this location.
   * </pre>
   *
   * <code>.grafeas.v1.SourceContext context = 3;</code>
   */
  @java.lang.Override
  public io.grafeas.v1.SourceContextOrBuilder getContextOrBuilder() {
    return getContext();
  }

  public static final int ADDITIONAL_CONTEXTS_FIELD_NUMBER = 4;
  private java.util.List<io.grafeas.v1.SourceContext> additionalContexts_;
  /**
   *
   *
   * <pre>
   * If provided, some of the source code used for the build may be found in
   * these locations, in the case where the source repository had multiple
   * remotes or submodules. This list will not include the context specified in
   * the context field.
   * </pre>
   *
   * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
   */
  @java.lang.Override
  public java.util.List<io.grafeas.v1.SourceContext> getAdditionalContextsList() {
    return additionalContexts_;
  }
  /**
   *
   *
   * <pre>
   * If provided, some of the source code used for the build may be found in
   * these locations, in the case where the source repository had multiple
   * remotes or submodules. This list will not include the context specified in
   * the context field.
   * </pre>
   *
   * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
   */
  @java.lang.Override
  public java.util.List<? extends io.grafeas.v1.SourceContextOrBuilder>
      getAdditionalContextsOrBuilderList() {
    return additionalContexts_;
  }
  /**
   *
   *
   * <pre>
   * If provided, some of the source code used for the build may be found in
   * these locations, in the case where the source repository had multiple
   * remotes or submodules. This list will not include the context specified in
   * the context field.
   * </pre>
   *
   * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
   */
  @java.lang.Override
  public int getAdditionalContextsCount() {
    return additionalContexts_.size();
  }
  /**
   *
   *
   * <pre>
   * If provided, some of the source code used for the build may be found in
   * these locations, in the case where the source repository had multiple
   * remotes or submodules. This list will not include the context specified in
   * the context field.
   * </pre>
   *
   * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
   */
  @java.lang.Override
  public io.grafeas.v1.SourceContext getAdditionalContexts(int index) {
    return additionalContexts_.get(index);
  }
  /**
   *
   *
   * <pre>
   * If provided, some of the source code used for the build may be found in
   * these locations, in the case where the source repository had multiple
   * remotes or submodules. This list will not include the context specified in
   * the context field.
   * </pre>
   *
   * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
   */
  @java.lang.Override
  public io.grafeas.v1.SourceContextOrBuilder getAdditionalContextsOrBuilder(int index) {
    return additionalContexts_.get(index);
  }

  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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(artifactStorageSourceUri_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, artifactStorageSourceUri_);
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetFileHashes(), FileHashesDefaultEntryHolder.defaultEntry, 2);
    if (context_ != null) {
      output.writeMessage(3, getContext());
    }
    for (int i = 0; i < additionalContexts_.size(); i++) {
      output.writeMessage(4, additionalContexts_.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(artifactStorageSourceUri_)) {
      size +=
          com.google.protobuf.GeneratedMessageV3.computeStringSize(1, artifactStorageSourceUri_);
    }
    for (java.util.Map.Entry<java.lang.String, io.grafeas.v1.FileHashes> entry :
        internalGetFileHashes().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, io.grafeas.v1.FileHashes> fileHashes__ =
          FileHashesDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, fileHashes__);
    }
    if (context_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getContext());
    }
    for (int i = 0; i < additionalContexts_.size(); i++) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(4, additionalContexts_.get(i));
    }
    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 io.grafeas.v1.Source)) {
      return super.equals(obj);
    }
    io.grafeas.v1.Source other = (io.grafeas.v1.Source) obj;

    if (!getArtifactStorageSourceUri().equals(other.getArtifactStorageSourceUri())) return false;
    if (!internalGetFileHashes().equals(other.internalGetFileHashes())) return false;
    if (hasContext() != other.hasContext()) return false;
    if (hasContext()) {
      if (!getContext().equals(other.getContext())) return false;
    }
    if (!getAdditionalContextsList().equals(other.getAdditionalContextsList())) 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) + ARTIFACT_STORAGE_SOURCE_URI_FIELD_NUMBER;
    hash = (53 * hash) + getArtifactStorageSourceUri().hashCode();
    if (!internalGetFileHashes().getMap().isEmpty()) {
      hash = (37 * hash) + FILE_HASHES_FIELD_NUMBER;
      hash = (53 * hash) + internalGetFileHashes().hashCode();
    }
    if (hasContext()) {
      hash = (37 * hash) + CONTEXT_FIELD_NUMBER;
      hash = (53 * hash) + getContext().hashCode();
    }
    if (getAdditionalContextsCount() > 0) {
      hash = (37 * hash) + ADDITIONAL_CONTEXTS_FIELD_NUMBER;
      hash = (53 * hash) + getAdditionalContextsList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static io.grafeas.v1.Source parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

  public static io.grafeas.v1.Source parseFrom(com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static io.grafeas.v1.Source parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static io.grafeas.v1.Source parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

  public static io.grafeas.v1.Source 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(io.grafeas.v1.Source 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>
   * Source describes the location of the source used for the build.
   * </pre>
   *
   * Protobuf type {@code grafeas.v1.Source}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:grafeas.v1.Source)
      io.grafeas.v1.SourceOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return io.grafeas.v1.Provenance.internal_static_grafeas_v1_Source_descriptor;
    }

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

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

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return io.grafeas.v1.Provenance.internal_static_grafeas_v1_Source_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              io.grafeas.v1.Source.class, io.grafeas.v1.Source.Builder.class);
    }

    // Construct using io.grafeas.v1.Source.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      artifactStorageSourceUri_ = "";

      internalGetMutableFileHashes().clear();
      if (contextBuilder_ == null) {
        context_ = null;
      } else {
        context_ = null;
        contextBuilder_ = null;
      }
      if (additionalContextsBuilder_ == null) {
        additionalContexts_ = java.util.Collections.emptyList();
      } else {
        additionalContexts_ = null;
        additionalContextsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000002);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return io.grafeas.v1.Provenance.internal_static_grafeas_v1_Source_descriptor;
    }

    @java.lang.Override
    public io.grafeas.v1.Source getDefaultInstanceForType() {
      return io.grafeas.v1.Source.getDefaultInstance();
    }

    @java.lang.Override
    public io.grafeas.v1.Source build() {
      io.grafeas.v1.Source result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public io.grafeas.v1.Source buildPartial() {
      io.grafeas.v1.Source result = new io.grafeas.v1.Source(this);
      int from_bitField0_ = bitField0_;
      result.artifactStorageSourceUri_ = artifactStorageSourceUri_;
      result.fileHashes_ = internalGetFileHashes();
      result.fileHashes_.makeImmutable();
      if (contextBuilder_ == null) {
        result.context_ = context_;
      } else {
        result.context_ = contextBuilder_.build();
      }
      if (additionalContextsBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)) {
          additionalContexts_ = java.util.Collections.unmodifiableList(additionalContexts_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.additionalContexts_ = additionalContexts_;
      } else {
        result.additionalContexts_ = additionalContextsBuilder_.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 io.grafeas.v1.Source) {
        return mergeFrom((io.grafeas.v1.Source) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(io.grafeas.v1.Source other) {
      if (other == io.grafeas.v1.Source.getDefaultInstance()) return this;
      if (!other.getArtifactStorageSourceUri().isEmpty()) {
        artifactStorageSourceUri_ = other.artifactStorageSourceUri_;
        onChanged();
      }
      internalGetMutableFileHashes().mergeFrom(other.internalGetFileHashes());
      if (other.hasContext()) {
        mergeContext(other.getContext());
      }
      if (additionalContextsBuilder_ == null) {
        if (!other.additionalContexts_.isEmpty()) {
          if (additionalContexts_.isEmpty()) {
            additionalContexts_ = other.additionalContexts_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureAdditionalContextsIsMutable();
            additionalContexts_.addAll(other.additionalContexts_);
          }
          onChanged();
        }
      } else {
        if (!other.additionalContexts_.isEmpty()) {
          if (additionalContextsBuilder_.isEmpty()) {
            additionalContextsBuilder_.dispose();
            additionalContextsBuilder_ = null;
            additionalContexts_ = other.additionalContexts_;
            bitField0_ = (bitField0_ & ~0x00000002);
            additionalContextsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getAdditionalContextsFieldBuilder()
                    : null;
          } else {
            additionalContextsBuilder_.addAllMessages(other.additionalContexts_);
          }
        }
      }
      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:
              {
                artifactStorageSourceUri_ = input.readStringRequireUtf8();

                break;
              } // case 10
            case 18:
              {
                com.google.protobuf.MapEntry<java.lang.String, io.grafeas.v1.FileHashes>
                    fileHashes__ =
                        input.readMessage(
                            FileHashesDefaultEntryHolder.defaultEntry.getParserForType(),
                            extensionRegistry);
                internalGetMutableFileHashes()
                    .getMutableMap()
                    .put(fileHashes__.getKey(), fileHashes__.getValue());
                break;
              } // case 18
            case 26:
              {
                input.readMessage(getContextFieldBuilder().getBuilder(), extensionRegistry);

                break;
              } // case 26
            case 34:
              {
                io.grafeas.v1.SourceContext m =
                    input.readMessage(io.grafeas.v1.SourceContext.parser(), extensionRegistry);
                if (additionalContextsBuilder_ == null) {
                  ensureAdditionalContextsIsMutable();
                  additionalContexts_.add(m);
                } else {
                  additionalContextsBuilder_.addMessage(m);
                }
                break;
              } // case 34
            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 artifactStorageSourceUri_ = "";
    /**
     *
     *
     * <pre>
     * If provided, the input binary artifacts for the build came from this
     * location.
     * </pre>
     *
     * <code>string artifact_storage_source_uri = 1;</code>
     *
     * @return The artifactStorageSourceUri.
     */
    public java.lang.String getArtifactStorageSourceUri() {
      java.lang.Object ref = artifactStorageSourceUri_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        artifactStorageSourceUri_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * If provided, the input binary artifacts for the build came from this
     * location.
     * </pre>
     *
     * <code>string artifact_storage_source_uri = 1;</code>
     *
     * @return The bytes for artifactStorageSourceUri.
     */
    public com.google.protobuf.ByteString getArtifactStorageSourceUriBytes() {
      java.lang.Object ref = artifactStorageSourceUri_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        artifactStorageSourceUri_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * If provided, the input binary artifacts for the build came from this
     * location.
     * </pre>
     *
     * <code>string artifact_storage_source_uri = 1;</code>
     *
     * @param value The artifactStorageSourceUri to set.
     * @return This builder for chaining.
     */
    public Builder setArtifactStorageSourceUri(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      artifactStorageSourceUri_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, the input binary artifacts for the build came from this
     * location.
     * </pre>
     *
     * <code>string artifact_storage_source_uri = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearArtifactStorageSourceUri() {

      artifactStorageSourceUri_ = getDefaultInstance().getArtifactStorageSourceUri();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, the input binary artifacts for the build came from this
     * location.
     * </pre>
     *
     * <code>string artifact_storage_source_uri = 1;</code>
     *
     * @param value The bytes for artifactStorageSourceUri to set.
     * @return This builder for chaining.
     */
    public Builder setArtifactStorageSourceUriBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

    private com.google.protobuf.MapField<java.lang.String, io.grafeas.v1.FileHashes> fileHashes_;

    private com.google.protobuf.MapField<java.lang.String, io.grafeas.v1.FileHashes>
        internalGetFileHashes() {
      if (fileHashes_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            FileHashesDefaultEntryHolder.defaultEntry);
      }
      return fileHashes_;
    }

    private com.google.protobuf.MapField<java.lang.String, io.grafeas.v1.FileHashes>
        internalGetMutableFileHashes() {
      onChanged();
      ;
      if (fileHashes_ == null) {
        fileHashes_ =
            com.google.protobuf.MapField.newMapField(FileHashesDefaultEntryHolder.defaultEntry);
      }
      if (!fileHashes_.isMutable()) {
        fileHashes_ = fileHashes_.copy();
      }
      return fileHashes_;
    }

    public int getFileHashesCount() {
      return internalGetFileHashes().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * Hash(es) of the build source, which can be used to verify that the original
     * source integrity was maintained in the build.
     * The keys to this map are file paths used as build source and the values
     * contain the hash values for those files.
     * If the build source came in a single package such as a gzipped tarfile
     * (.tar.gz), the FileHash will be for the single path to that file.
     * </pre>
     *
     * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
     */
    @java.lang.Override
    public boolean containsFileHashes(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      return internalGetFileHashes().getMap().containsKey(key);
    }
    /** Use {@link #getFileHashesMap()} instead. */
    @java.lang.Override
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> getFileHashes() {
      return getFileHashesMap();
    }
    /**
     *
     *
     * <pre>
     * Hash(es) of the build source, which can be used to verify that the original
     * source integrity was maintained in the build.
     * The keys to this map are file paths used as build source and the values
     * contain the hash values for those files.
     * If the build source came in a single package such as a gzipped tarfile
     * (.tar.gz), the FileHash will be for the single path to that file.
     * </pre>
     *
     * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
     */
    @java.lang.Override
    public java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> getFileHashesMap() {
      return internalGetFileHashes().getMap();
    }
    /**
     *
     *
     * <pre>
     * Hash(es) of the build source, which can be used to verify that the original
     * source integrity was maintained in the build.
     * The keys to this map are file paths used as build source and the values
     * contain the hash values for those files.
     * If the build source came in a single package such as a gzipped tarfile
     * (.tar.gz), the FileHash will be for the single path to that file.
     * </pre>
     *
     * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
     */
    @java.lang.Override
    public io.grafeas.v1.FileHashes getFileHashesOrDefault(
        java.lang.String key, io.grafeas.v1.FileHashes defaultValue) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> map =
          internalGetFileHashes().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * Hash(es) of the build source, which can be used to verify that the original
     * source integrity was maintained in the build.
     * The keys to this map are file paths used as build source and the values
     * contain the hash values for those files.
     * If the build source came in a single package such as a gzipped tarfile
     * (.tar.gz), the FileHash will be for the single path to that file.
     * </pre>
     *
     * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
     */
    @java.lang.Override
    public io.grafeas.v1.FileHashes getFileHashesOrThrow(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> map =
          internalGetFileHashes().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearFileHashes() {
      internalGetMutableFileHashes().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Hash(es) of the build source, which can be used to verify that the original
     * source integrity was maintained in the build.
     * The keys to this map are file paths used as build source and the values
     * contain the hash values for those files.
     * If the build source came in a single package such as a gzipped tarfile
     * (.tar.gz), the FileHash will be for the single path to that file.
     * </pre>
     *
     * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
     */
    public Builder removeFileHashes(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      internalGetMutableFileHashes().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> getMutableFileHashes() {
      return internalGetMutableFileHashes().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * Hash(es) of the build source, which can be used to verify that the original
     * source integrity was maintained in the build.
     * The keys to this map are file paths used as build source and the values
     * contain the hash values for those files.
     * If the build source came in a single package such as a gzipped tarfile
     * (.tar.gz), the FileHash will be for the single path to that file.
     * </pre>
     *
     * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
     */
    public Builder putFileHashes(java.lang.String key, io.grafeas.v1.FileHashes value) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      if (value == null) {
        throw new NullPointerException("map value");
      }

      internalGetMutableFileHashes().getMutableMap().put(key, value);
      return this;
    }
    /**
     *
     *
     * <pre>
     * Hash(es) of the build source, which can be used to verify that the original
     * source integrity was maintained in the build.
     * The keys to this map are file paths used as build source and the values
     * contain the hash values for those files.
     * If the build source came in a single package such as a gzipped tarfile
     * (.tar.gz), the FileHash will be for the single path to that file.
     * </pre>
     *
     * <code>map&lt;string, .grafeas.v1.FileHashes&gt; file_hashes = 2;</code>
     */
    public Builder putAllFileHashes(
        java.util.Map<java.lang.String, io.grafeas.v1.FileHashes> values) {
      internalGetMutableFileHashes().getMutableMap().putAll(values);
      return this;
    }

    private io.grafeas.v1.SourceContext context_;
    private com.google.protobuf.SingleFieldBuilderV3<
            io.grafeas.v1.SourceContext,
            io.grafeas.v1.SourceContext.Builder,
            io.grafeas.v1.SourceContextOrBuilder>
        contextBuilder_;
    /**
     *
     *
     * <pre>
     * If provided, the source code used for the build came from this location.
     * </pre>
     *
     * <code>.grafeas.v1.SourceContext context = 3;</code>
     *
     * @return Whether the context field is set.
     */
    public boolean hasContext() {
      return contextBuilder_ != null || context_ != null;
    }
    /**
     *
     *
     * <pre>
     * If provided, the source code used for the build came from this location.
     * </pre>
     *
     * <code>.grafeas.v1.SourceContext context = 3;</code>
     *
     * @return The context.
     */
    public io.grafeas.v1.SourceContext getContext() {
      if (contextBuilder_ == null) {
        return context_ == null ? io.grafeas.v1.SourceContext.getDefaultInstance() : context_;
      } else {
        return contextBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * If provided, the source code used for the build came from this location.
     * </pre>
     *
     * <code>.grafeas.v1.SourceContext context = 3;</code>
     */
    public Builder setContext(io.grafeas.v1.SourceContext value) {
      if (contextBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        context_ = value;
        onChanged();
      } else {
        contextBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, the source code used for the build came from this location.
     * </pre>
     *
     * <code>.grafeas.v1.SourceContext context = 3;</code>
     */
    public Builder setContext(io.grafeas.v1.SourceContext.Builder builderForValue) {
      if (contextBuilder_ == null) {
        context_ = builderForValue.build();
        onChanged();
      } else {
        contextBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, the source code used for the build came from this location.
     * </pre>
     *
     * <code>.grafeas.v1.SourceContext context = 3;</code>
     */
    public Builder mergeContext(io.grafeas.v1.SourceContext value) {
      if (contextBuilder_ == null) {
        if (context_ != null) {
          context_ =
              io.grafeas.v1.SourceContext.newBuilder(context_).mergeFrom(value).buildPartial();
        } else {
          context_ = value;
        }
        onChanged();
      } else {
        contextBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, the source code used for the build came from this location.
     * </pre>
     *
     * <code>.grafeas.v1.SourceContext context = 3;</code>
     */
    public Builder clearContext() {
      if (contextBuilder_ == null) {
        context_ = null;
        onChanged();
      } else {
        context_ = null;
        contextBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, the source code used for the build came from this location.
     * </pre>
     *
     * <code>.grafeas.v1.SourceContext context = 3;</code>
     */
    public io.grafeas.v1.SourceContext.Builder getContextBuilder() {

      onChanged();
      return getContextFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * If provided, the source code used for the build came from this location.
     * </pre>
     *
     * <code>.grafeas.v1.SourceContext context = 3;</code>
     */
    public io.grafeas.v1.SourceContextOrBuilder getContextOrBuilder() {
      if (contextBuilder_ != null) {
        return contextBuilder_.getMessageOrBuilder();
      } else {
        return context_ == null ? io.grafeas.v1.SourceContext.getDefaultInstance() : context_;
      }
    }
    /**
     *
     *
     * <pre>
     * If provided, the source code used for the build came from this location.
     * </pre>
     *
     * <code>.grafeas.v1.SourceContext context = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            io.grafeas.v1.SourceContext,
            io.grafeas.v1.SourceContext.Builder,
            io.grafeas.v1.SourceContextOrBuilder>
        getContextFieldBuilder() {
      if (contextBuilder_ == null) {
        contextBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                io.grafeas.v1.SourceContext,
                io.grafeas.v1.SourceContext.Builder,
                io.grafeas.v1.SourceContextOrBuilder>(
                getContext(), getParentForChildren(), isClean());
        context_ = null;
      }
      return contextBuilder_;
    }

    private java.util.List<io.grafeas.v1.SourceContext> additionalContexts_ =
        java.util.Collections.emptyList();

    private void ensureAdditionalContextsIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        additionalContexts_ =
            new java.util.ArrayList<io.grafeas.v1.SourceContext>(additionalContexts_);
        bitField0_ |= 0x00000002;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            io.grafeas.v1.SourceContext,
            io.grafeas.v1.SourceContext.Builder,
            io.grafeas.v1.SourceContextOrBuilder>
        additionalContextsBuilder_;

    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public java.util.List<io.grafeas.v1.SourceContext> getAdditionalContextsList() {
      if (additionalContextsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(additionalContexts_);
      } else {
        return additionalContextsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public int getAdditionalContextsCount() {
      if (additionalContextsBuilder_ == null) {
        return additionalContexts_.size();
      } else {
        return additionalContextsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public io.grafeas.v1.SourceContext getAdditionalContexts(int index) {
      if (additionalContextsBuilder_ == null) {
        return additionalContexts_.get(index);
      } else {
        return additionalContextsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public Builder setAdditionalContexts(int index, io.grafeas.v1.SourceContext value) {
      if (additionalContextsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureAdditionalContextsIsMutable();
        additionalContexts_.set(index, value);
        onChanged();
      } else {
        additionalContextsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public Builder setAdditionalContexts(
        int index, io.grafeas.v1.SourceContext.Builder builderForValue) {
      if (additionalContextsBuilder_ == null) {
        ensureAdditionalContextsIsMutable();
        additionalContexts_.set(index, builderForValue.build());
        onChanged();
      } else {
        additionalContextsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public Builder addAdditionalContexts(io.grafeas.v1.SourceContext value) {
      if (additionalContextsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureAdditionalContextsIsMutable();
        additionalContexts_.add(value);
        onChanged();
      } else {
        additionalContextsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public Builder addAdditionalContexts(int index, io.grafeas.v1.SourceContext value) {
      if (additionalContextsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureAdditionalContextsIsMutable();
        additionalContexts_.add(index, value);
        onChanged();
      } else {
        additionalContextsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public Builder addAdditionalContexts(io.grafeas.v1.SourceContext.Builder builderForValue) {
      if (additionalContextsBuilder_ == null) {
        ensureAdditionalContextsIsMutable();
        additionalContexts_.add(builderForValue.build());
        onChanged();
      } else {
        additionalContextsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public Builder addAdditionalContexts(
        int index, io.grafeas.v1.SourceContext.Builder builderForValue) {
      if (additionalContextsBuilder_ == null) {
        ensureAdditionalContextsIsMutable();
        additionalContexts_.add(index, builderForValue.build());
        onChanged();
      } else {
        additionalContextsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public Builder addAllAdditionalContexts(
        java.lang.Iterable<? extends io.grafeas.v1.SourceContext> values) {
      if (additionalContextsBuilder_ == null) {
        ensureAdditionalContextsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, additionalContexts_);
        onChanged();
      } else {
        additionalContextsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public Builder clearAdditionalContexts() {
      if (additionalContextsBuilder_ == null) {
        additionalContexts_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        additionalContextsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public Builder removeAdditionalContexts(int index) {
      if (additionalContextsBuilder_ == null) {
        ensureAdditionalContextsIsMutable();
        additionalContexts_.remove(index);
        onChanged();
      } else {
        additionalContextsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public io.grafeas.v1.SourceContext.Builder getAdditionalContextsBuilder(int index) {
      return getAdditionalContextsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public io.grafeas.v1.SourceContextOrBuilder getAdditionalContextsOrBuilder(int index) {
      if (additionalContextsBuilder_ == null) {
        return additionalContexts_.get(index);
      } else {
        return additionalContextsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public java.util.List<? extends io.grafeas.v1.SourceContextOrBuilder>
        getAdditionalContextsOrBuilderList() {
      if (additionalContextsBuilder_ != null) {
        return additionalContextsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(additionalContexts_);
      }
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public io.grafeas.v1.SourceContext.Builder addAdditionalContextsBuilder() {
      return getAdditionalContextsFieldBuilder()
          .addBuilder(io.grafeas.v1.SourceContext.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public io.grafeas.v1.SourceContext.Builder addAdditionalContextsBuilder(int index) {
      return getAdditionalContextsFieldBuilder()
          .addBuilder(index, io.grafeas.v1.SourceContext.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * If provided, some of the source code used for the build may be found in
     * these locations, in the case where the source repository had multiple
     * remotes or submodules. This list will not include the context specified in
     * the context field.
     * </pre>
     *
     * <code>repeated .grafeas.v1.SourceContext additional_contexts = 4;</code>
     */
    public java.util.List<io.grafeas.v1.SourceContext.Builder> getAdditionalContextsBuilderList() {
      return getAdditionalContextsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            io.grafeas.v1.SourceContext,
            io.grafeas.v1.SourceContext.Builder,
            io.grafeas.v1.SourceContextOrBuilder>
        getAdditionalContextsFieldBuilder() {
      if (additionalContextsBuilder_ == null) {
        additionalContextsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                io.grafeas.v1.SourceContext,
                io.grafeas.v1.SourceContext.Builder,
                io.grafeas.v1.SourceContextOrBuilder>(
                additionalContexts_,
                ((bitField0_ & 0x00000002) != 0),
                getParentForChildren(),
                isClean());
        additionalContexts_ = null;
      }
      return additionalContextsBuilder_;
    }

    @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:grafeas.v1.Source)
  }

  // @@protoc_insertion_point(class_scope:grafeas.v1.Source)
  private static final io.grafeas.v1.Source DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new io.grafeas.v1.Source();
  }

  public static io.grafeas.v1.Source getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public io.grafeas.v1.Source getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}