PublicKeyIdentifier.java

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

package dev.sigstore.proto.common.v1;

/**
 * <pre>
 * PublicKeyIdentifier can be used to identify an (out of band) delivered
 * key, to verify a signature.
 * </pre>
 *
 * Protobuf type {@code dev.sigstore.common.v1.PublicKeyIdentifier}
 */
@javax.annotation.Generated(value="protoc", comments="annotations:PublicKeyIdentifier.java.pb.meta")
public final class PublicKeyIdentifier extends
    com.google.protobuf.GeneratedMessage implements
    // @@protoc_insertion_point(message_implements:dev.sigstore.common.v1.PublicKeyIdentifier)
    PublicKeyIdentifierOrBuilder {
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= */ "",
      PublicKeyIdentifier.class.getName());
  }
  // Use PublicKeyIdentifier.newBuilder() to construct.
  private PublicKeyIdentifier(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
  }
  private PublicKeyIdentifier() {
    hint_ = "";
  }

  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return dev.sigstore.proto.common.v1.CommonProto.internal_static_dev_sigstore_common_v1_PublicKeyIdentifier_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return dev.sigstore.proto.common.v1.CommonProto.internal_static_dev_sigstore_common_v1_PublicKeyIdentifier_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            dev.sigstore.proto.common.v1.PublicKeyIdentifier.class, dev.sigstore.proto.common.v1.PublicKeyIdentifier.Builder.class);
  }

  public static final int HINT_FIELD_NUMBER = 1;
  @SuppressWarnings("serial")
  private volatile java.lang.Object hint_ = "";
  /**
   * <pre>
   * Optional unauthenticated hint on which key to use.
   * The format of the hint must be agreed upon out of band by the
   * signer and the verifiers, and so is not subject to this
   * specification.
   * Example use-case is to specify the public key to use, from a
   * trusted key-ring.
   * Implementors are RECOMMENDED to derive the value from the public
   * key as described in RFC 6962.
   * See: &lt;https://www.rfc-editor.org/rfc/rfc6962#section-3.2&gt;
   * </pre>
   *
   * <code>string hint = 1;</code>
   * @return The hint.
   */
  @java.lang.Override
  public java.lang.String getHint() {
    java.lang.Object ref = hint_;
    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();
      hint_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Optional unauthenticated hint on which key to use.
   * The format of the hint must be agreed upon out of band by the
   * signer and the verifiers, and so is not subject to this
   * specification.
   * Example use-case is to specify the public key to use, from a
   * trusted key-ring.
   * Implementors are RECOMMENDED to derive the value from the public
   * key as described in RFC 6962.
   * See: &lt;https://www.rfc-editor.org/rfc/rfc6962#section-3.2&gt;
   * </pre>
   *
   * <code>string hint = 1;</code>
   * @return The bytes for hint.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getHintBytes() {
    java.lang.Object ref = hint_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      hint_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  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.GeneratedMessage.isStringEmpty(hint_)) {
      com.google.protobuf.GeneratedMessage.writeString(output, 1, hint_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (!com.google.protobuf.GeneratedMessage.isStringEmpty(hint_)) {
      size += com.google.protobuf.GeneratedMessage.computeStringSize(1, hint_);
    }
    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.proto.common.v1.PublicKeyIdentifier)) {
      return super.equals(obj);
    }
    dev.sigstore.proto.common.v1.PublicKeyIdentifier other = (dev.sigstore.proto.common.v1.PublicKeyIdentifier) obj;

    if (!getHint()
        .equals(other.getHint())) 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) + HINT_FIELD_NUMBER;
    hash = (53 * hash) + getHint().hashCode();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier 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.proto.common.v1.PublicKeyIdentifier parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseWithIOException(PARSER, input);
  }
  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier 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.proto.common.v1.PublicKeyIdentifier parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseDelimitedWithIOException(PARSER, input);
  }

  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier 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.proto.common.v1.PublicKeyIdentifier parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseWithIOException(PARSER, input);
  }
  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier 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.proto.common.v1.PublicKeyIdentifier 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;
  }
  /**
   * <pre>
   * PublicKeyIdentifier can be used to identify an (out of band) delivered
   * key, to verify a signature.
   * </pre>
   *
   * Protobuf type {@code dev.sigstore.common.v1.PublicKeyIdentifier}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessage.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:dev.sigstore.common.v1.PublicKeyIdentifier)
      dev.sigstore.proto.common.v1.PublicKeyIdentifierOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return dev.sigstore.proto.common.v1.CommonProto.internal_static_dev_sigstore_common_v1_PublicKeyIdentifier_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return dev.sigstore.proto.common.v1.CommonProto.internal_static_dev_sigstore_common_v1_PublicKeyIdentifier_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              dev.sigstore.proto.common.v1.PublicKeyIdentifier.class, dev.sigstore.proto.common.v1.PublicKeyIdentifier.Builder.class);
    }

    // Construct using dev.sigstore.proto.common.v1.PublicKeyIdentifier.newBuilder()
    private Builder() {

    }

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

    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      hint_ = "";
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return dev.sigstore.proto.common.v1.CommonProto.internal_static_dev_sigstore_common_v1_PublicKeyIdentifier_descriptor;
    }

    @java.lang.Override
    public dev.sigstore.proto.common.v1.PublicKeyIdentifier getDefaultInstanceForType() {
      return dev.sigstore.proto.common.v1.PublicKeyIdentifier.getDefaultInstance();
    }

    @java.lang.Override
    public dev.sigstore.proto.common.v1.PublicKeyIdentifier build() {
      dev.sigstore.proto.common.v1.PublicKeyIdentifier result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public dev.sigstore.proto.common.v1.PublicKeyIdentifier buildPartial() {
      dev.sigstore.proto.common.v1.PublicKeyIdentifier result = new dev.sigstore.proto.common.v1.PublicKeyIdentifier(this);
      if (bitField0_ != 0) { buildPartial0(result); }
      onBuilt();
      return result;
    }

    private void buildPartial0(dev.sigstore.proto.common.v1.PublicKeyIdentifier result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.hint_ = hint_;
      }
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof dev.sigstore.proto.common.v1.PublicKeyIdentifier) {
        return mergeFrom((dev.sigstore.proto.common.v1.PublicKeyIdentifier)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(dev.sigstore.proto.common.v1.PublicKeyIdentifier other) {
      if (other == dev.sigstore.proto.common.v1.PublicKeyIdentifier.getDefaultInstance()) return this;
      if (!other.getHint().isEmpty()) {
        hint_ = other.hint_;
        bitField0_ |= 0x00000001;
        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: {
              hint_ = input.readStringRequireUtf8();
              bitField0_ |= 0x00000001;
              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 java.lang.Object hint_ = "";
    /**
     * <pre>
     * Optional unauthenticated hint on which key to use.
     * The format of the hint must be agreed upon out of band by the
     * signer and the verifiers, and so is not subject to this
     * specification.
     * Example use-case is to specify the public key to use, from a
     * trusted key-ring.
     * Implementors are RECOMMENDED to derive the value from the public
     * key as described in RFC 6962.
     * See: &lt;https://www.rfc-editor.org/rfc/rfc6962#section-3.2&gt;
     * </pre>
     *
     * <code>string hint = 1;</code>
     * @return The hint.
     */
    public java.lang.String getHint() {
      java.lang.Object ref = hint_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        hint_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Optional unauthenticated hint on which key to use.
     * The format of the hint must be agreed upon out of band by the
     * signer and the verifiers, and so is not subject to this
     * specification.
     * Example use-case is to specify the public key to use, from a
     * trusted key-ring.
     * Implementors are RECOMMENDED to derive the value from the public
     * key as described in RFC 6962.
     * See: &lt;https://www.rfc-editor.org/rfc/rfc6962#section-3.2&gt;
     * </pre>
     *
     * <code>string hint = 1;</code>
     * @return The bytes for hint.
     */
    public com.google.protobuf.ByteString
        getHintBytes() {
      java.lang.Object ref = hint_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        hint_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Optional unauthenticated hint on which key to use.
     * The format of the hint must be agreed upon out of band by the
     * signer and the verifiers, and so is not subject to this
     * specification.
     * Example use-case is to specify the public key to use, from a
     * trusted key-ring.
     * Implementors are RECOMMENDED to derive the value from the public
     * key as described in RFC 6962.
     * See: &lt;https://www.rfc-editor.org/rfc/rfc6962#section-3.2&gt;
     * </pre>
     *
     * <code>string hint = 1;</code>
     * @param value The hint to set.
     * @return This builder for chaining.
     */
    public Builder setHint(
        java.lang.String value) {
      if (value == null) { throw new NullPointerException(); }
      hint_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional unauthenticated hint on which key to use.
     * The format of the hint must be agreed upon out of band by the
     * signer and the verifiers, and so is not subject to this
     * specification.
     * Example use-case is to specify the public key to use, from a
     * trusted key-ring.
     * Implementors are RECOMMENDED to derive the value from the public
     * key as described in RFC 6962.
     * See: &lt;https://www.rfc-editor.org/rfc/rfc6962#section-3.2&gt;
     * </pre>
     *
     * <code>string hint = 1;</code>
     * @return This builder for chaining.
     */
    public Builder clearHint() {
      hint_ = getDefaultInstance().getHint();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional unauthenticated hint on which key to use.
     * The format of the hint must be agreed upon out of band by the
     * signer and the verifiers, and so is not subject to this
     * specification.
     * Example use-case is to specify the public key to use, from a
     * trusted key-ring.
     * Implementors are RECOMMENDED to derive the value from the public
     * key as described in RFC 6962.
     * See: &lt;https://www.rfc-editor.org/rfc/rfc6962#section-3.2&gt;
     * </pre>
     *
     * <code>string hint = 1;</code>
     * @param value The bytes for hint to set.
     * @return This builder for chaining.
     */
    public Builder setHintBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) { throw new NullPointerException(); }
      checkByteStringIsUtf8(value);
      hint_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    // @@protoc_insertion_point(builder_scope:dev.sigstore.common.v1.PublicKeyIdentifier)
  }

  // @@protoc_insertion_point(class_scope:dev.sigstore.common.v1.PublicKeyIdentifier)
  private static final dev.sigstore.proto.common.v1.PublicKeyIdentifier DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new dev.sigstore.proto.common.v1.PublicKeyIdentifier();
  }

  public static dev.sigstore.proto.common.v1.PublicKeyIdentifier getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public dev.sigstore.proto.common.v1.PublicKeyIdentifier getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}