BuildOccurrence.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/build.proto

package io.grafeas.v1;

/**
 *
 *
 * <pre>
 * Details of a build occurrence.
 * </pre>
 *
 * Protobuf type {@code grafeas.v1.BuildOccurrence}
 */
public final class BuildOccurrence extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:grafeas.v1.BuildOccurrence)
    BuildOccurrenceOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use BuildOccurrence.newBuilder() to construct.
  private BuildOccurrence(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private BuildOccurrence() {
    provenanceBytes_ = "";
  }

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

  @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.Build.internal_static_grafeas_v1_BuildOccurrence_descriptor;
  }

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

  public static final int PROVENANCE_FIELD_NUMBER = 1;
  private io.grafeas.v1.BuildProvenance provenance_;
  /**
   *
   *
   * <pre>
   * The actual provenance for the build.
   * </pre>
   *
   * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
   *
   * @return Whether the provenance field is set.
   */
  @java.lang.Override
  public boolean hasProvenance() {
    return provenance_ != null;
  }
  /**
   *
   *
   * <pre>
   * The actual provenance for the build.
   * </pre>
   *
   * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
   *
   * @return The provenance.
   */
  @java.lang.Override
  public io.grafeas.v1.BuildProvenance getProvenance() {
    return provenance_ == null ? io.grafeas.v1.BuildProvenance.getDefaultInstance() : provenance_;
  }
  /**
   *
   *
   * <pre>
   * The actual provenance for the build.
   * </pre>
   *
   * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
   */
  @java.lang.Override
  public io.grafeas.v1.BuildProvenanceOrBuilder getProvenanceOrBuilder() {
    return getProvenance();
  }

  public static final int PROVENANCE_BYTES_FIELD_NUMBER = 2;
  private volatile java.lang.Object provenanceBytes_;
  /**
   *
   *
   * <pre>
   * Serialized JSON representation of the provenance, used in generating the
   * build signature in the corresponding build note. After verifying the
   * signature, `provenance_bytes` can be unmarshalled and compared to the
   * provenance to confirm that it is unchanged. A base64-encoded string
   * representation of the provenance bytes is used for the signature in order
   * to interoperate with openssl which expects this format for signature
   * verification.
   * The serialized form is captured both to avoid ambiguity in how the
   * provenance is marshalled to json as well to prevent incompatibilities with
   * future changes.
   * </pre>
   *
   * <code>string provenance_bytes = 2;</code>
   *
   * @return The provenanceBytes.
   */
  @java.lang.Override
  public java.lang.String getProvenanceBytes() {
    java.lang.Object ref = provenanceBytes_;
    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();
      provenanceBytes_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Serialized JSON representation of the provenance, used in generating the
   * build signature in the corresponding build note. After verifying the
   * signature, `provenance_bytes` can be unmarshalled and compared to the
   * provenance to confirm that it is unchanged. A base64-encoded string
   * representation of the provenance bytes is used for the signature in order
   * to interoperate with openssl which expects this format for signature
   * verification.
   * The serialized form is captured both to avoid ambiguity in how the
   * provenance is marshalled to json as well to prevent incompatibilities with
   * future changes.
   * </pre>
   *
   * <code>string provenance_bytes = 2;</code>
   *
   * @return The bytes for provenanceBytes.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getProvenanceBytesBytes() {
    java.lang.Object ref = provenanceBytes_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      provenanceBytes_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int INTOTO_PROVENANCE_FIELD_NUMBER = 3;
  private io.grafeas.v1.InTotoProvenance intotoProvenance_;
  /**
   *
   *
   * <pre>
   * Deprecated. See InTotoStatement for the replacement.
   * In-toto Provenance representation as defined in spec.
   * </pre>
   *
   * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
   *
   * @return Whether the intotoProvenance field is set.
   */
  @java.lang.Override
  public boolean hasIntotoProvenance() {
    return intotoProvenance_ != null;
  }
  /**
   *
   *
   * <pre>
   * Deprecated. See InTotoStatement for the replacement.
   * In-toto Provenance representation as defined in spec.
   * </pre>
   *
   * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
   *
   * @return The intotoProvenance.
   */
  @java.lang.Override
  public io.grafeas.v1.InTotoProvenance getIntotoProvenance() {
    return intotoProvenance_ == null
        ? io.grafeas.v1.InTotoProvenance.getDefaultInstance()
        : intotoProvenance_;
  }
  /**
   *
   *
   * <pre>
   * Deprecated. See InTotoStatement for the replacement.
   * In-toto Provenance representation as defined in spec.
   * </pre>
   *
   * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
   */
  @java.lang.Override
  public io.grafeas.v1.InTotoProvenanceOrBuilder getIntotoProvenanceOrBuilder() {
    return getIntotoProvenance();
  }

  public static final int INTOTO_STATEMENT_FIELD_NUMBER = 4;
  private io.grafeas.v1.InTotoStatement intotoStatement_;
  /**
   *
   *
   * <pre>
   * In-toto Statement representation as defined in spec.
   * The intoto_statement can contain any type of provenance. The serialized
   * payload of the statement can be stored and signed in the Occurrence's
   * envelope.
   * </pre>
   *
   * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
   *
   * @return Whether the intotoStatement field is set.
   */
  @java.lang.Override
  public boolean hasIntotoStatement() {
    return intotoStatement_ != null;
  }
  /**
   *
   *
   * <pre>
   * In-toto Statement representation as defined in spec.
   * The intoto_statement can contain any type of provenance. The serialized
   * payload of the statement can be stored and signed in the Occurrence's
   * envelope.
   * </pre>
   *
   * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
   *
   * @return The intotoStatement.
   */
  @java.lang.Override
  public io.grafeas.v1.InTotoStatement getIntotoStatement() {
    return intotoStatement_ == null
        ? io.grafeas.v1.InTotoStatement.getDefaultInstance()
        : intotoStatement_;
  }
  /**
   *
   *
   * <pre>
   * In-toto Statement representation as defined in spec.
   * The intoto_statement can contain any type of provenance. The serialized
   * payload of the statement can be stored and signed in the Occurrence's
   * envelope.
   * </pre>
   *
   * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
   */
  @java.lang.Override
  public io.grafeas.v1.InTotoStatementOrBuilder getIntotoStatementOrBuilder() {
    return getIntotoStatement();
  }

  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 (provenance_ != null) {
      output.writeMessage(1, getProvenance());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(provenanceBytes_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, provenanceBytes_);
    }
    if (intotoProvenance_ != null) {
      output.writeMessage(3, getIntotoProvenance());
    }
    if (intotoStatement_ != null) {
      output.writeMessage(4, getIntotoStatement());
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (provenance_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getProvenance());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(provenanceBytes_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, provenanceBytes_);
    }
    if (intotoProvenance_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getIntotoProvenance());
    }
    if (intotoStatement_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getIntotoStatement());
    }
    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.BuildOccurrence)) {
      return super.equals(obj);
    }
    io.grafeas.v1.BuildOccurrence other = (io.grafeas.v1.BuildOccurrence) obj;

    if (hasProvenance() != other.hasProvenance()) return false;
    if (hasProvenance()) {
      if (!getProvenance().equals(other.getProvenance())) return false;
    }
    if (!getProvenanceBytes().equals(other.getProvenanceBytes())) return false;
    if (hasIntotoProvenance() != other.hasIntotoProvenance()) return false;
    if (hasIntotoProvenance()) {
      if (!getIntotoProvenance().equals(other.getIntotoProvenance())) return false;
    }
    if (hasIntotoStatement() != other.hasIntotoStatement()) return false;
    if (hasIntotoStatement()) {
      if (!getIntotoStatement().equals(other.getIntotoStatement())) 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();
    if (hasProvenance()) {
      hash = (37 * hash) + PROVENANCE_FIELD_NUMBER;
      hash = (53 * hash) + getProvenance().hashCode();
    }
    hash = (37 * hash) + PROVENANCE_BYTES_FIELD_NUMBER;
    hash = (53 * hash) + getProvenanceBytes().hashCode();
    if (hasIntotoProvenance()) {
      hash = (37 * hash) + INTOTO_PROVENANCE_FIELD_NUMBER;
      hash = (53 * hash) + getIntotoProvenance().hashCode();
    }
    if (hasIntotoStatement()) {
      hash = (37 * hash) + INTOTO_STATEMENT_FIELD_NUMBER;
      hash = (53 * hash) + getIntotoStatement().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static io.grafeas.v1.BuildOccurrence 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.BuildOccurrence parseFrom(com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

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

  public static io.grafeas.v1.BuildOccurrence 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.BuildOccurrence 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>
   * Details of a build occurrence.
   * </pre>
   *
   * Protobuf type {@code grafeas.v1.BuildOccurrence}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:grafeas.v1.BuildOccurrence)
      io.grafeas.v1.BuildOccurrenceOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return io.grafeas.v1.Build.internal_static_grafeas_v1_BuildOccurrence_descriptor;
    }

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

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

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (provenanceBuilder_ == null) {
        provenance_ = null;
      } else {
        provenance_ = null;
        provenanceBuilder_ = null;
      }
      provenanceBytes_ = "";

      if (intotoProvenanceBuilder_ == null) {
        intotoProvenance_ = null;
      } else {
        intotoProvenance_ = null;
        intotoProvenanceBuilder_ = null;
      }
      if (intotoStatementBuilder_ == null) {
        intotoStatement_ = null;
      } else {
        intotoStatement_ = null;
        intotoStatementBuilder_ = null;
      }
      return this;
    }

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

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

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

    @java.lang.Override
    public io.grafeas.v1.BuildOccurrence buildPartial() {
      io.grafeas.v1.BuildOccurrence result = new io.grafeas.v1.BuildOccurrence(this);
      if (provenanceBuilder_ == null) {
        result.provenance_ = provenance_;
      } else {
        result.provenance_ = provenanceBuilder_.build();
      }
      result.provenanceBytes_ = provenanceBytes_;
      if (intotoProvenanceBuilder_ == null) {
        result.intotoProvenance_ = intotoProvenance_;
      } else {
        result.intotoProvenance_ = intotoProvenanceBuilder_.build();
      }
      if (intotoStatementBuilder_ == null) {
        result.intotoStatement_ = intotoStatement_;
      } else {
        result.intotoStatement_ = intotoStatementBuilder_.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.BuildOccurrence) {
        return mergeFrom((io.grafeas.v1.BuildOccurrence) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(io.grafeas.v1.BuildOccurrence other) {
      if (other == io.grafeas.v1.BuildOccurrence.getDefaultInstance()) return this;
      if (other.hasProvenance()) {
        mergeProvenance(other.getProvenance());
      }
      if (!other.getProvenanceBytes().isEmpty()) {
        provenanceBytes_ = other.provenanceBytes_;
        onChanged();
      }
      if (other.hasIntotoProvenance()) {
        mergeIntotoProvenance(other.getIntotoProvenance());
      }
      if (other.hasIntotoStatement()) {
        mergeIntotoStatement(other.getIntotoStatement());
      }
      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:
              {
                input.readMessage(getProvenanceFieldBuilder().getBuilder(), extensionRegistry);

                break;
              } // case 10
            case 18:
              {
                provenanceBytes_ = input.readStringRequireUtf8();

                break;
              } // case 18
            case 26:
              {
                input.readMessage(
                    getIntotoProvenanceFieldBuilder().getBuilder(), extensionRegistry);

                break;
              } // case 26
            case 34:
              {
                input.readMessage(getIntotoStatementFieldBuilder().getBuilder(), extensionRegistry);

                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 io.grafeas.v1.BuildProvenance provenance_;
    private com.google.protobuf.SingleFieldBuilderV3<
            io.grafeas.v1.BuildProvenance,
            io.grafeas.v1.BuildProvenance.Builder,
            io.grafeas.v1.BuildProvenanceOrBuilder>
        provenanceBuilder_;
    /**
     *
     *
     * <pre>
     * The actual provenance for the build.
     * </pre>
     *
     * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
     *
     * @return Whether the provenance field is set.
     */
    public boolean hasProvenance() {
      return provenanceBuilder_ != null || provenance_ != null;
    }
    /**
     *
     *
     * <pre>
     * The actual provenance for the build.
     * </pre>
     *
     * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
     *
     * @return The provenance.
     */
    public io.grafeas.v1.BuildProvenance getProvenance() {
      if (provenanceBuilder_ == null) {
        return provenance_ == null
            ? io.grafeas.v1.BuildProvenance.getDefaultInstance()
            : provenance_;
      } else {
        return provenanceBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * The actual provenance for the build.
     * </pre>
     *
     * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
     */
    public Builder setProvenance(io.grafeas.v1.BuildProvenance value) {
      if (provenanceBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        provenance_ = value;
        onChanged();
      } else {
        provenanceBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The actual provenance for the build.
     * </pre>
     *
     * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
     */
    public Builder setProvenance(io.grafeas.v1.BuildProvenance.Builder builderForValue) {
      if (provenanceBuilder_ == null) {
        provenance_ = builderForValue.build();
        onChanged();
      } else {
        provenanceBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The actual provenance for the build.
     * </pre>
     *
     * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
     */
    public Builder mergeProvenance(io.grafeas.v1.BuildProvenance value) {
      if (provenanceBuilder_ == null) {
        if (provenance_ != null) {
          provenance_ =
              io.grafeas.v1.BuildProvenance.newBuilder(provenance_).mergeFrom(value).buildPartial();
        } else {
          provenance_ = value;
        }
        onChanged();
      } else {
        provenanceBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The actual provenance for the build.
     * </pre>
     *
     * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
     */
    public Builder clearProvenance() {
      if (provenanceBuilder_ == null) {
        provenance_ = null;
        onChanged();
      } else {
        provenance_ = null;
        provenanceBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The actual provenance for the build.
     * </pre>
     *
     * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
     */
    public io.grafeas.v1.BuildProvenance.Builder getProvenanceBuilder() {

      onChanged();
      return getProvenanceFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The actual provenance for the build.
     * </pre>
     *
     * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
     */
    public io.grafeas.v1.BuildProvenanceOrBuilder getProvenanceOrBuilder() {
      if (provenanceBuilder_ != null) {
        return provenanceBuilder_.getMessageOrBuilder();
      } else {
        return provenance_ == null
            ? io.grafeas.v1.BuildProvenance.getDefaultInstance()
            : provenance_;
      }
    }
    /**
     *
     *
     * <pre>
     * The actual provenance for the build.
     * </pre>
     *
     * <code>.grafeas.v1.BuildProvenance provenance = 1;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            io.grafeas.v1.BuildProvenance,
            io.grafeas.v1.BuildProvenance.Builder,
            io.grafeas.v1.BuildProvenanceOrBuilder>
        getProvenanceFieldBuilder() {
      if (provenanceBuilder_ == null) {
        provenanceBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                io.grafeas.v1.BuildProvenance,
                io.grafeas.v1.BuildProvenance.Builder,
                io.grafeas.v1.BuildProvenanceOrBuilder>(
                getProvenance(), getParentForChildren(), isClean());
        provenance_ = null;
      }
      return provenanceBuilder_;
    }

    private java.lang.Object provenanceBytes_ = "";
    /**
     *
     *
     * <pre>
     * Serialized JSON representation of the provenance, used in generating the
     * build signature in the corresponding build note. After verifying the
     * signature, `provenance_bytes` can be unmarshalled and compared to the
     * provenance to confirm that it is unchanged. A base64-encoded string
     * representation of the provenance bytes is used for the signature in order
     * to interoperate with openssl which expects this format for signature
     * verification.
     * The serialized form is captured both to avoid ambiguity in how the
     * provenance is marshalled to json as well to prevent incompatibilities with
     * future changes.
     * </pre>
     *
     * <code>string provenance_bytes = 2;</code>
     *
     * @return The provenanceBytes.
     */
    public java.lang.String getProvenanceBytes() {
      java.lang.Object ref = provenanceBytes_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        provenanceBytes_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Serialized JSON representation of the provenance, used in generating the
     * build signature in the corresponding build note. After verifying the
     * signature, `provenance_bytes` can be unmarshalled and compared to the
     * provenance to confirm that it is unchanged. A base64-encoded string
     * representation of the provenance bytes is used for the signature in order
     * to interoperate with openssl which expects this format for signature
     * verification.
     * The serialized form is captured both to avoid ambiguity in how the
     * provenance is marshalled to json as well to prevent incompatibilities with
     * future changes.
     * </pre>
     *
     * <code>string provenance_bytes = 2;</code>
     *
     * @return The bytes for provenanceBytes.
     */
    public com.google.protobuf.ByteString getProvenanceBytesBytes() {
      java.lang.Object ref = provenanceBytes_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        provenanceBytes_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Serialized JSON representation of the provenance, used in generating the
     * build signature in the corresponding build note. After verifying the
     * signature, `provenance_bytes` can be unmarshalled and compared to the
     * provenance to confirm that it is unchanged. A base64-encoded string
     * representation of the provenance bytes is used for the signature in order
     * to interoperate with openssl which expects this format for signature
     * verification.
     * The serialized form is captured both to avoid ambiguity in how the
     * provenance is marshalled to json as well to prevent incompatibilities with
     * future changes.
     * </pre>
     *
     * <code>string provenance_bytes = 2;</code>
     *
     * @param value The provenanceBytes to set.
     * @return This builder for chaining.
     */
    public Builder setProvenanceBytes(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      provenanceBytes_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Serialized JSON representation of the provenance, used in generating the
     * build signature in the corresponding build note. After verifying the
     * signature, `provenance_bytes` can be unmarshalled and compared to the
     * provenance to confirm that it is unchanged. A base64-encoded string
     * representation of the provenance bytes is used for the signature in order
     * to interoperate with openssl which expects this format for signature
     * verification.
     * The serialized form is captured both to avoid ambiguity in how the
     * provenance is marshalled to json as well to prevent incompatibilities with
     * future changes.
     * </pre>
     *
     * <code>string provenance_bytes = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearProvenanceBytes() {

      provenanceBytes_ = getDefaultInstance().getProvenanceBytes();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Serialized JSON representation of the provenance, used in generating the
     * build signature in the corresponding build note. After verifying the
     * signature, `provenance_bytes` can be unmarshalled and compared to the
     * provenance to confirm that it is unchanged. A base64-encoded string
     * representation of the provenance bytes is used for the signature in order
     * to interoperate with openssl which expects this format for signature
     * verification.
     * The serialized form is captured both to avoid ambiguity in how the
     * provenance is marshalled to json as well to prevent incompatibilities with
     * future changes.
     * </pre>
     *
     * <code>string provenance_bytes = 2;</code>
     *
     * @param value The bytes for provenanceBytes to set.
     * @return This builder for chaining.
     */
    public Builder setProvenanceBytesBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

    private io.grafeas.v1.InTotoProvenance intotoProvenance_;
    private com.google.protobuf.SingleFieldBuilderV3<
            io.grafeas.v1.InTotoProvenance,
            io.grafeas.v1.InTotoProvenance.Builder,
            io.grafeas.v1.InTotoProvenanceOrBuilder>
        intotoProvenanceBuilder_;
    /**
     *
     *
     * <pre>
     * Deprecated. See InTotoStatement for the replacement.
     * In-toto Provenance representation as defined in spec.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
     *
     * @return Whether the intotoProvenance field is set.
     */
    public boolean hasIntotoProvenance() {
      return intotoProvenanceBuilder_ != null || intotoProvenance_ != null;
    }
    /**
     *
     *
     * <pre>
     * Deprecated. See InTotoStatement for the replacement.
     * In-toto Provenance representation as defined in spec.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
     *
     * @return The intotoProvenance.
     */
    public io.grafeas.v1.InTotoProvenance getIntotoProvenance() {
      if (intotoProvenanceBuilder_ == null) {
        return intotoProvenance_ == null
            ? io.grafeas.v1.InTotoProvenance.getDefaultInstance()
            : intotoProvenance_;
      } else {
        return intotoProvenanceBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Deprecated. See InTotoStatement for the replacement.
     * In-toto Provenance representation as defined in spec.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
     */
    public Builder setIntotoProvenance(io.grafeas.v1.InTotoProvenance value) {
      if (intotoProvenanceBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        intotoProvenance_ = value;
        onChanged();
      } else {
        intotoProvenanceBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Deprecated. See InTotoStatement for the replacement.
     * In-toto Provenance representation as defined in spec.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
     */
    public Builder setIntotoProvenance(io.grafeas.v1.InTotoProvenance.Builder builderForValue) {
      if (intotoProvenanceBuilder_ == null) {
        intotoProvenance_ = builderForValue.build();
        onChanged();
      } else {
        intotoProvenanceBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Deprecated. See InTotoStatement for the replacement.
     * In-toto Provenance representation as defined in spec.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
     */
    public Builder mergeIntotoProvenance(io.grafeas.v1.InTotoProvenance value) {
      if (intotoProvenanceBuilder_ == null) {
        if (intotoProvenance_ != null) {
          intotoProvenance_ =
              io.grafeas.v1.InTotoProvenance.newBuilder(intotoProvenance_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          intotoProvenance_ = value;
        }
        onChanged();
      } else {
        intotoProvenanceBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Deprecated. See InTotoStatement for the replacement.
     * In-toto Provenance representation as defined in spec.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
     */
    public Builder clearIntotoProvenance() {
      if (intotoProvenanceBuilder_ == null) {
        intotoProvenance_ = null;
        onChanged();
      } else {
        intotoProvenance_ = null;
        intotoProvenanceBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Deprecated. See InTotoStatement for the replacement.
     * In-toto Provenance representation as defined in spec.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
     */
    public io.grafeas.v1.InTotoProvenance.Builder getIntotoProvenanceBuilder() {

      onChanged();
      return getIntotoProvenanceFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Deprecated. See InTotoStatement for the replacement.
     * In-toto Provenance representation as defined in spec.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
     */
    public io.grafeas.v1.InTotoProvenanceOrBuilder getIntotoProvenanceOrBuilder() {
      if (intotoProvenanceBuilder_ != null) {
        return intotoProvenanceBuilder_.getMessageOrBuilder();
      } else {
        return intotoProvenance_ == null
            ? io.grafeas.v1.InTotoProvenance.getDefaultInstance()
            : intotoProvenance_;
      }
    }
    /**
     *
     *
     * <pre>
     * Deprecated. See InTotoStatement for the replacement.
     * In-toto Provenance representation as defined in spec.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoProvenance intoto_provenance = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            io.grafeas.v1.InTotoProvenance,
            io.grafeas.v1.InTotoProvenance.Builder,
            io.grafeas.v1.InTotoProvenanceOrBuilder>
        getIntotoProvenanceFieldBuilder() {
      if (intotoProvenanceBuilder_ == null) {
        intotoProvenanceBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                io.grafeas.v1.InTotoProvenance,
                io.grafeas.v1.InTotoProvenance.Builder,
                io.grafeas.v1.InTotoProvenanceOrBuilder>(
                getIntotoProvenance(), getParentForChildren(), isClean());
        intotoProvenance_ = null;
      }
      return intotoProvenanceBuilder_;
    }

    private io.grafeas.v1.InTotoStatement intotoStatement_;
    private com.google.protobuf.SingleFieldBuilderV3<
            io.grafeas.v1.InTotoStatement,
            io.grafeas.v1.InTotoStatement.Builder,
            io.grafeas.v1.InTotoStatementOrBuilder>
        intotoStatementBuilder_;
    /**
     *
     *
     * <pre>
     * In-toto Statement representation as defined in spec.
     * The intoto_statement can contain any type of provenance. The serialized
     * payload of the statement can be stored and signed in the Occurrence's
     * envelope.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
     *
     * @return Whether the intotoStatement field is set.
     */
    public boolean hasIntotoStatement() {
      return intotoStatementBuilder_ != null || intotoStatement_ != null;
    }
    /**
     *
     *
     * <pre>
     * In-toto Statement representation as defined in spec.
     * The intoto_statement can contain any type of provenance. The serialized
     * payload of the statement can be stored and signed in the Occurrence's
     * envelope.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
     *
     * @return The intotoStatement.
     */
    public io.grafeas.v1.InTotoStatement getIntotoStatement() {
      if (intotoStatementBuilder_ == null) {
        return intotoStatement_ == null
            ? io.grafeas.v1.InTotoStatement.getDefaultInstance()
            : intotoStatement_;
      } else {
        return intotoStatementBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * In-toto Statement representation as defined in spec.
     * The intoto_statement can contain any type of provenance. The serialized
     * payload of the statement can be stored and signed in the Occurrence's
     * envelope.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
     */
    public Builder setIntotoStatement(io.grafeas.v1.InTotoStatement value) {
      if (intotoStatementBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        intotoStatement_ = value;
        onChanged();
      } else {
        intotoStatementBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * In-toto Statement representation as defined in spec.
     * The intoto_statement can contain any type of provenance. The serialized
     * payload of the statement can be stored and signed in the Occurrence's
     * envelope.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
     */
    public Builder setIntotoStatement(io.grafeas.v1.InTotoStatement.Builder builderForValue) {
      if (intotoStatementBuilder_ == null) {
        intotoStatement_ = builderForValue.build();
        onChanged();
      } else {
        intotoStatementBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * In-toto Statement representation as defined in spec.
     * The intoto_statement can contain any type of provenance. The serialized
     * payload of the statement can be stored and signed in the Occurrence's
     * envelope.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
     */
    public Builder mergeIntotoStatement(io.grafeas.v1.InTotoStatement value) {
      if (intotoStatementBuilder_ == null) {
        if (intotoStatement_ != null) {
          intotoStatement_ =
              io.grafeas.v1.InTotoStatement.newBuilder(intotoStatement_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          intotoStatement_ = value;
        }
        onChanged();
      } else {
        intotoStatementBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * In-toto Statement representation as defined in spec.
     * The intoto_statement can contain any type of provenance. The serialized
     * payload of the statement can be stored and signed in the Occurrence's
     * envelope.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
     */
    public Builder clearIntotoStatement() {
      if (intotoStatementBuilder_ == null) {
        intotoStatement_ = null;
        onChanged();
      } else {
        intotoStatement_ = null;
        intotoStatementBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * In-toto Statement representation as defined in spec.
     * The intoto_statement can contain any type of provenance. The serialized
     * payload of the statement can be stored and signed in the Occurrence's
     * envelope.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
     */
    public io.grafeas.v1.InTotoStatement.Builder getIntotoStatementBuilder() {

      onChanged();
      return getIntotoStatementFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * In-toto Statement representation as defined in spec.
     * The intoto_statement can contain any type of provenance. The serialized
     * payload of the statement can be stored and signed in the Occurrence's
     * envelope.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
     */
    public io.grafeas.v1.InTotoStatementOrBuilder getIntotoStatementOrBuilder() {
      if (intotoStatementBuilder_ != null) {
        return intotoStatementBuilder_.getMessageOrBuilder();
      } else {
        return intotoStatement_ == null
            ? io.grafeas.v1.InTotoStatement.getDefaultInstance()
            : intotoStatement_;
      }
    }
    /**
     *
     *
     * <pre>
     * In-toto Statement representation as defined in spec.
     * The intoto_statement can contain any type of provenance. The serialized
     * payload of the statement can be stored and signed in the Occurrence's
     * envelope.
     * </pre>
     *
     * <code>.grafeas.v1.InTotoStatement intoto_statement = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            io.grafeas.v1.InTotoStatement,
            io.grafeas.v1.InTotoStatement.Builder,
            io.grafeas.v1.InTotoStatementOrBuilder>
        getIntotoStatementFieldBuilder() {
      if (intotoStatementBuilder_ == null) {
        intotoStatementBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                io.grafeas.v1.InTotoStatement,
                io.grafeas.v1.InTotoStatement.Builder,
                io.grafeas.v1.InTotoStatementOrBuilder>(
                getIntotoStatement(), getParentForChildren(), isClean());
        intotoStatement_ = null;
      }
      return intotoStatementBuilder_;
    }

    @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.BuildOccurrence)
  }

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

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

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

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

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

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