CertificateChain.java

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: fulcio.proto
// Protobuf Java Version: 4.30.2

package dev.sigstore.fulcio.v2;

/**
 * Protobuf type {@code dev.sigstore.fulcio.v2.CertificateChain}
 */
@javax.annotation.Generated(value="protoc", comments="annotations:CertificateChain.java.pb.meta")
public final class CertificateChain extends
    com.google.protobuf.GeneratedMessage implements
    // @@protoc_insertion_point(message_implements:dev.sigstore.fulcio.v2.CertificateChain)
    CertificateChainOrBuilder {
private static final long serialVersionUID = 0L;
  static {
    com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
      com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
      /* major= */ 4,
      /* minor= */ 30,
      /* patch= */ 2,
      /* suffix= */ "",
      CertificateChain.class.getName());
  }
  // Use CertificateChain.newBuilder() to construct.
  private CertificateChain(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
  }
  private CertificateChain() {
    certificates_ =
        com.google.protobuf.LazyStringArrayList.emptyList();
  }

  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return dev.sigstore.fulcio.v2.FulcioProto.internal_static_dev_sigstore_fulcio_v2_CertificateChain_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return dev.sigstore.fulcio.v2.FulcioProto.internal_static_dev_sigstore_fulcio_v2_CertificateChain_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            dev.sigstore.fulcio.v2.CertificateChain.class, dev.sigstore.fulcio.v2.CertificateChain.Builder.class);
  }

  public static final int CERTIFICATES_FIELD_NUMBER = 1;
  @SuppressWarnings("serial")
  private com.google.protobuf.LazyStringArrayList certificates_ =
      com.google.protobuf.LazyStringArrayList.emptyList();
  /**
   * <pre>
   *
   * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
   * </pre>
   *
   * <code>repeated string certificates = 1;</code>
   * @return A list containing the certificates.
   */
  public com.google.protobuf.ProtocolStringList
      getCertificatesList() {
    return certificates_;
  }
  /**
   * <pre>
   *
   * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
   * </pre>
   *
   * <code>repeated string certificates = 1;</code>
   * @return The count of certificates.
   */
  public int getCertificatesCount() {
    return certificates_.size();
  }
  /**
   * <pre>
   *
   * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
   * </pre>
   *
   * <code>repeated string certificates = 1;</code>
   * @param index The index of the element to return.
   * @return The certificates at the given index.
   */
  public java.lang.String getCertificates(int index) {
    return certificates_.get(index);
  }
  /**
   * <pre>
   *
   * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
   * </pre>
   *
   * <code>repeated string certificates = 1;</code>
   * @param index The index of the value to return.
   * @return The bytes of the certificates at the given index.
   */
  public com.google.protobuf.ByteString
      getCertificatesBytes(int index) {
    return certificates_.getByteString(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 {
    for (int i = 0; i < certificates_.size(); i++) {
      com.google.protobuf.GeneratedMessage.writeString(output, 1, certificates_.getRaw(i));
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    {
      int dataSize = 0;
      for (int i = 0; i < certificates_.size(); i++) {
        dataSize += computeStringSizeNoTag(certificates_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getCertificatesList().size();
    }
    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 dev.sigstore.fulcio.v2.CertificateChain)) {
      return super.equals(obj);
    }
    dev.sigstore.fulcio.v2.CertificateChain other = (dev.sigstore.fulcio.v2.CertificateChain) obj;

    if (!getCertificatesList()
        .equals(other.getCertificatesList())) 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 (getCertificatesCount() > 0) {
      hash = (37 * hash) + CERTIFICATES_FIELD_NUMBER;
      hash = (53 * hash) + getCertificatesList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseWithIOException(PARSER, input);
  }
  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public static dev.sigstore.fulcio.v2.CertificateChain parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseDelimitedWithIOException(PARSER, input);
  }

  public static dev.sigstore.fulcio.v2.CertificateChain parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseWithIOException(PARSER, input);
  }
  public static dev.sigstore.fulcio.v2.CertificateChain parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(dev.sigstore.fulcio.v2.CertificateChain 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.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * Protobuf type {@code dev.sigstore.fulcio.v2.CertificateChain}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessage.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:dev.sigstore.fulcio.v2.CertificateChain)
      dev.sigstore.fulcio.v2.CertificateChainOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return dev.sigstore.fulcio.v2.FulcioProto.internal_static_dev_sigstore_fulcio_v2_CertificateChain_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return dev.sigstore.fulcio.v2.FulcioProto.internal_static_dev_sigstore_fulcio_v2_CertificateChain_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              dev.sigstore.fulcio.v2.CertificateChain.class, dev.sigstore.fulcio.v2.CertificateChain.Builder.class);
    }

    // Construct using dev.sigstore.fulcio.v2.CertificateChain.newBuilder()
    private Builder() {

    }

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

    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      certificates_ =
          com.google.protobuf.LazyStringArrayList.emptyList();
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return dev.sigstore.fulcio.v2.FulcioProto.internal_static_dev_sigstore_fulcio_v2_CertificateChain_descriptor;
    }

    @java.lang.Override
    public dev.sigstore.fulcio.v2.CertificateChain getDefaultInstanceForType() {
      return dev.sigstore.fulcio.v2.CertificateChain.getDefaultInstance();
    }

    @java.lang.Override
    public dev.sigstore.fulcio.v2.CertificateChain build() {
      dev.sigstore.fulcio.v2.CertificateChain result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public dev.sigstore.fulcio.v2.CertificateChain buildPartial() {
      dev.sigstore.fulcio.v2.CertificateChain result = new dev.sigstore.fulcio.v2.CertificateChain(this);
      if (bitField0_ != 0) { buildPartial0(result); }
      onBuilt();
      return result;
    }

    private void buildPartial0(dev.sigstore.fulcio.v2.CertificateChain result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        certificates_.makeImmutable();
        result.certificates_ = certificates_;
      }
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof dev.sigstore.fulcio.v2.CertificateChain) {
        return mergeFrom((dev.sigstore.fulcio.v2.CertificateChain)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(dev.sigstore.fulcio.v2.CertificateChain other) {
      if (other == dev.sigstore.fulcio.v2.CertificateChain.getDefaultInstance()) return this;
      if (!other.certificates_.isEmpty()) {
        if (certificates_.isEmpty()) {
          certificates_ = other.certificates_;
          bitField0_ |= 0x00000001;
        } else {
          ensureCertificatesIsMutable();
          certificates_.addAll(other.certificates_);
        }
        onChanged();
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10: {
              java.lang.String s = input.readStringRequireUtf8();
              ensureCertificatesIsMutable();
              certificates_.add(s);
              break;
            } // case 10
            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 com.google.protobuf.LazyStringArrayList certificates_ =
        com.google.protobuf.LazyStringArrayList.emptyList();
    private void ensureCertificatesIsMutable() {
      if (!certificates_.isModifiable()) {
        certificates_ = new com.google.protobuf.LazyStringArrayList(certificates_);
      }
      bitField0_ |= 0x00000001;
    }
    /**
     * <pre>
     *
     * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
     * </pre>
     *
     * <code>repeated string certificates = 1;</code>
     * @return A list containing the certificates.
     */
    public com.google.protobuf.ProtocolStringList
        getCertificatesList() {
      certificates_.makeImmutable();
      return certificates_;
    }
    /**
     * <pre>
     *
     * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
     * </pre>
     *
     * <code>repeated string certificates = 1;</code>
     * @return The count of certificates.
     */
    public int getCertificatesCount() {
      return certificates_.size();
    }
    /**
     * <pre>
     *
     * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
     * </pre>
     *
     * <code>repeated string certificates = 1;</code>
     * @param index The index of the element to return.
     * @return The certificates at the given index.
     */
    public java.lang.String getCertificates(int index) {
      return certificates_.get(index);
    }
    /**
     * <pre>
     *
     * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
     * </pre>
     *
     * <code>repeated string certificates = 1;</code>
     * @param index The index of the value to return.
     * @return The bytes of the certificates at the given index.
     */
    public com.google.protobuf.ByteString
        getCertificatesBytes(int index) {
      return certificates_.getByteString(index);
    }
    /**
     * <pre>
     *
     * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
     * </pre>
     *
     * <code>repeated string certificates = 1;</code>
     * @param index The index to set the value at.
     * @param value The certificates to set.
     * @return This builder for chaining.
     */
    public Builder setCertificates(
        int index, java.lang.String value) {
      if (value == null) { throw new NullPointerException(); }
      ensureCertificatesIsMutable();
      certificates_.set(index, value);
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     * <pre>
     *
     * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
     * </pre>
     *
     * <code>repeated string certificates = 1;</code>
     * @param value The certificates to add.
     * @return This builder for chaining.
     */
    public Builder addCertificates(
        java.lang.String value) {
      if (value == null) { throw new NullPointerException(); }
      ensureCertificatesIsMutable();
      certificates_.add(value);
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     * <pre>
     *
     * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
     * </pre>
     *
     * <code>repeated string certificates = 1;</code>
     * @param values The certificates to add.
     * @return This builder for chaining.
     */
    public Builder addAllCertificates(
        java.lang.Iterable<java.lang.String> values) {
      ensureCertificatesIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(
          values, certificates_);
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     * <pre>
     *
     * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
     * </pre>
     *
     * <code>repeated string certificates = 1;</code>
     * @return This builder for chaining.
     */
    public Builder clearCertificates() {
      certificates_ =
        com.google.protobuf.LazyStringArrayList.emptyList();
      bitField0_ = (bitField0_ & ~0x00000001);;
      onChanged();
      return this;
    }
    /**
     * <pre>
     *
     * The PEM-encoded certificate chain, ordered from leaf to intermediate to root as applicable.
     * </pre>
     *
     * <code>repeated string certificates = 1;</code>
     * @param value The bytes of the certificates to add.
     * @return This builder for chaining.
     */
    public Builder addCertificatesBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) { throw new NullPointerException(); }
      checkByteStringIsUtf8(value);
      ensureCertificatesIsMutable();
      certificates_.add(value);
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    // @@protoc_insertion_point(builder_scope:dev.sigstore.fulcio.v2.CertificateChain)
  }

  // @@protoc_insertion_point(class_scope:dev.sigstore.fulcio.v2.CertificateChain)
  private static final dev.sigstore.fulcio.v2.CertificateChain DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new dev.sigstore.fulcio.v2.CertificateChain();
  }

  public static dev.sigstore.fulcio.v2.CertificateChain getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public dev.sigstore.fulcio.v2.CertificateChain getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}