ServiceConfiguration.java

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

package dev.sigstore.proto.trustroot.v1;

/**
 * <pre>
 * ServiceConfiguration specifies how a client should select a set of
 * Services to connect to, along with a count when a specific number
 * of Services is requested.
 * </pre>
 *
 * Protobuf type {@code dev.sigstore.trustroot.v1.ServiceConfiguration}
 */
@javax.annotation.Generated(value="protoc", comments="annotations:ServiceConfiguration.java.pb.meta")
public final class ServiceConfiguration extends
    com.google.protobuf.GeneratedMessage implements
    // @@protoc_insertion_point(message_implements:dev.sigstore.trustroot.v1.ServiceConfiguration)
    ServiceConfigurationOrBuilder {
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= */ "",
      ServiceConfiguration.class.getName());
  }
  // Use ServiceConfiguration.newBuilder() to construct.
  private ServiceConfiguration(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
  }
  private ServiceConfiguration() {
    selector_ = 0;
  }

  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return dev.sigstore.proto.trustroot.v1.TrustRootProto.internal_static_dev_sigstore_trustroot_v1_ServiceConfiguration_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return dev.sigstore.proto.trustroot.v1.TrustRootProto.internal_static_dev_sigstore_trustroot_v1_ServiceConfiguration_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            dev.sigstore.proto.trustroot.v1.ServiceConfiguration.class, dev.sigstore.proto.trustroot.v1.ServiceConfiguration.Builder.class);
  }

  public static final int SELECTOR_FIELD_NUMBER = 1;
  private int selector_ = 0;
  /**
   * <pre>
   * How a client should select a set of Services to connect to.
   * Clients SHOULD NOT select services from multiple API versions.
   * </pre>
   *
   * <code>.dev.sigstore.trustroot.v1.ServiceSelector selector = 1;</code>
   * @return The enum numeric value on the wire for selector.
   */
  @java.lang.Override public int getSelectorValue() {
    return selector_;
  }
  /**
   * <pre>
   * How a client should select a set of Services to connect to.
   * Clients SHOULD NOT select services from multiple API versions.
   * </pre>
   *
   * <code>.dev.sigstore.trustroot.v1.ServiceSelector selector = 1;</code>
   * @return The selector.
   */
  @java.lang.Override public dev.sigstore.proto.trustroot.v1.ServiceSelector getSelector() {
    dev.sigstore.proto.trustroot.v1.ServiceSelector result = dev.sigstore.proto.trustroot.v1.ServiceSelector.forNumber(selector_);
    return result == null ? dev.sigstore.proto.trustroot.v1.ServiceSelector.UNRECOGNIZED : result;
  }

  public static final int COUNT_FIELD_NUMBER = 2;
  private int count_ = 0;
  /**
   * <pre>
   * count specifies the number of Services the client should use.
   * Only used when selector is set to EXACT, and count MUST be greater
   * than 0. count MUST be less than or equal to the number of Services.
   * Clients MUST return an error is there are not enough services
   * that meet selection criteria.
   * </pre>
   *
   * <code>uint32 count = 2;</code>
   * @return The count.
   */
  @java.lang.Override
  public int getCount() {
    return count_;
  }

  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 (selector_ != dev.sigstore.proto.trustroot.v1.ServiceSelector.SERVICE_SELECTOR_UNDEFINED.getNumber()) {
      output.writeEnum(1, selector_);
    }
    if (count_ != 0) {
      output.writeUInt32(2, count_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (selector_ != dev.sigstore.proto.trustroot.v1.ServiceSelector.SERVICE_SELECTOR_UNDEFINED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream
        .computeEnumSize(1, selector_);
    }
    if (count_ != 0) {
      size += com.google.protobuf.CodedOutputStream
        .computeUInt32Size(2, count_);
    }
    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.trustroot.v1.ServiceConfiguration)) {
      return super.equals(obj);
    }
    dev.sigstore.proto.trustroot.v1.ServiceConfiguration other = (dev.sigstore.proto.trustroot.v1.ServiceConfiguration) obj;

    if (selector_ != other.selector_) return false;
    if (getCount()
        != other.getCount()) 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) + SELECTOR_FIELD_NUMBER;
    hash = (53 * hash) + selector_;
    hash = (37 * hash) + COUNT_FIELD_NUMBER;
    hash = (53 * hash) + getCount();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static dev.sigstore.proto.trustroot.v1.ServiceConfiguration 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.trustroot.v1.ServiceConfiguration parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage
        .parseWithIOException(PARSER, input);
  }
  public static dev.sigstore.proto.trustroot.v1.ServiceConfiguration 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.trustroot.v1.ServiceConfiguration 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>
   * ServiceConfiguration specifies how a client should select a set of
   * Services to connect to, along with a count when a specific number
   * of Services is requested.
   * </pre>
   *
   * Protobuf type {@code dev.sigstore.trustroot.v1.ServiceConfiguration}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessage.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:dev.sigstore.trustroot.v1.ServiceConfiguration)
      dev.sigstore.proto.trustroot.v1.ServiceConfigurationOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return dev.sigstore.proto.trustroot.v1.TrustRootProto.internal_static_dev_sigstore_trustroot_v1_ServiceConfiguration_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return dev.sigstore.proto.trustroot.v1.TrustRootProto.internal_static_dev_sigstore_trustroot_v1_ServiceConfiguration_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              dev.sigstore.proto.trustroot.v1.ServiceConfiguration.class, dev.sigstore.proto.trustroot.v1.ServiceConfiguration.Builder.class);
    }

    // Construct using dev.sigstore.proto.trustroot.v1.ServiceConfiguration.newBuilder()
    private Builder() {

    }

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

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

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return dev.sigstore.proto.trustroot.v1.TrustRootProto.internal_static_dev_sigstore_trustroot_v1_ServiceConfiguration_descriptor;
    }

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

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

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

    private void buildPartial0(dev.sigstore.proto.trustroot.v1.ServiceConfiguration result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.selector_ = selector_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.count_ = count_;
      }
    }

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

    public Builder mergeFrom(dev.sigstore.proto.trustroot.v1.ServiceConfiguration other) {
      if (other == dev.sigstore.proto.trustroot.v1.ServiceConfiguration.getDefaultInstance()) return this;
      if (other.selector_ != 0) {
        setSelectorValue(other.getSelectorValue());
      }
      if (other.getCount() != 0) {
        setCount(other.getCount());
      }
      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 8: {
              selector_ = input.readEnum();
              bitField0_ |= 0x00000001;
              break;
            } // case 8
            case 16: {
              count_ = input.readUInt32();
              bitField0_ |= 0x00000002;
              break;
            } // case 16
            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 int selector_ = 0;
    /**
     * <pre>
     * How a client should select a set of Services to connect to.
     * Clients SHOULD NOT select services from multiple API versions.
     * </pre>
     *
     * <code>.dev.sigstore.trustroot.v1.ServiceSelector selector = 1;</code>
     * @return The enum numeric value on the wire for selector.
     */
    @java.lang.Override public int getSelectorValue() {
      return selector_;
    }
    /**
     * <pre>
     * How a client should select a set of Services to connect to.
     * Clients SHOULD NOT select services from multiple API versions.
     * </pre>
     *
     * <code>.dev.sigstore.trustroot.v1.ServiceSelector selector = 1;</code>
     * @param value The enum numeric value on the wire for selector to set.
     * @return This builder for chaining.
     */
    public Builder setSelectorValue(int value) {
      selector_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * How a client should select a set of Services to connect to.
     * Clients SHOULD NOT select services from multiple API versions.
     * </pre>
     *
     * <code>.dev.sigstore.trustroot.v1.ServiceSelector selector = 1;</code>
     * @return The selector.
     */
    @java.lang.Override
    public dev.sigstore.proto.trustroot.v1.ServiceSelector getSelector() {
      dev.sigstore.proto.trustroot.v1.ServiceSelector result = dev.sigstore.proto.trustroot.v1.ServiceSelector.forNumber(selector_);
      return result == null ? dev.sigstore.proto.trustroot.v1.ServiceSelector.UNRECOGNIZED : result;
    }
    /**
     * <pre>
     * How a client should select a set of Services to connect to.
     * Clients SHOULD NOT select services from multiple API versions.
     * </pre>
     *
     * <code>.dev.sigstore.trustroot.v1.ServiceSelector selector = 1;</code>
     * @param value The selector to set.
     * @return This builder for chaining.
     */
    public Builder setSelector(dev.sigstore.proto.trustroot.v1.ServiceSelector value) {
      if (value == null) {
        throw new NullPointerException();
      }
      bitField0_ |= 0x00000001;
      selector_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * How a client should select a set of Services to connect to.
     * Clients SHOULD NOT select services from multiple API versions.
     * </pre>
     *
     * <code>.dev.sigstore.trustroot.v1.ServiceSelector selector = 1;</code>
     * @return This builder for chaining.
     */
    public Builder clearSelector() {
      bitField0_ = (bitField0_ & ~0x00000001);
      selector_ = 0;
      onChanged();
      return this;
    }

    private int count_ ;
    /**
     * <pre>
     * count specifies the number of Services the client should use.
     * Only used when selector is set to EXACT, and count MUST be greater
     * than 0. count MUST be less than or equal to the number of Services.
     * Clients MUST return an error is there are not enough services
     * that meet selection criteria.
     * </pre>
     *
     * <code>uint32 count = 2;</code>
     * @return The count.
     */
    @java.lang.Override
    public int getCount() {
      return count_;
    }
    /**
     * <pre>
     * count specifies the number of Services the client should use.
     * Only used when selector is set to EXACT, and count MUST be greater
     * than 0. count MUST be less than or equal to the number of Services.
     * Clients MUST return an error is there are not enough services
     * that meet selection criteria.
     * </pre>
     *
     * <code>uint32 count = 2;</code>
     * @param value The count to set.
     * @return This builder for chaining.
     */
    public Builder setCount(int value) {

      count_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * count specifies the number of Services the client should use.
     * Only used when selector is set to EXACT, and count MUST be greater
     * than 0. count MUST be less than or equal to the number of Services.
     * Clients MUST return an error is there are not enough services
     * that meet selection criteria.
     * </pre>
     *
     * <code>uint32 count = 2;</code>
     * @return This builder for chaining.
     */
    public Builder clearCount() {
      bitField0_ = (bitField0_ & ~0x00000002);
      count_ = 0;
      onChanged();
      return this;
    }

    // @@protoc_insertion_point(builder_scope:dev.sigstore.trustroot.v1.ServiceConfiguration)
  }

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

  public static dev.sigstore.proto.trustroot.v1.ServiceConfiguration getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

}