All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.protobuf.EnumValueOptions Maven / Gradle / Ivy

There is a newer version: 3.4.2
Show newest version
// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: google/protobuf/descriptor.proto
package com.google.protobuf;

import com.squareup.wire.FieldEncoding;
import com.squareup.wire.Message;
import com.squareup.wire.ProtoAdapter;
import com.squareup.wire.ProtoReader;
import com.squareup.wire.ProtoWriter;
import com.squareup.wire.ReverseProtoWriter;
import com.squareup.wire.Syntax;
import com.squareup.wire.WireField;
import com.squareup.wire.internal.Internal;
import java.io.IOException;
import java.lang.Boolean;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.util.List;
import okio.ByteString;

public final class EnumValueOptions extends Message {
  public static final ProtoAdapter ADAPTER = new ProtoAdapter_EnumValueOptions();

  private static final long serialVersionUID = 0L;

  public static final Boolean DEFAULT_DEPRECATED = false;

  public static final Boolean DEFAULT_DEBUG_REDACT = false;

  /**
   * Is this enum value deprecated?
   * Depending on the target platform, this can emit Deprecated annotations
   * for the enum value, or it will be completely ignored; in the very least,
   * this is a formalization for deprecating enum values.
   */
  @WireField(
      tag = 1,
      adapter = "com.squareup.wire.ProtoAdapter#BOOL"
  )
  public final Boolean deprecated;

  /**
   * Any features defined in the specific edition.
   */
  @WireField(
      tag = 2,
      adapter = "com.google.protobuf.FeatureSet#ADAPTER"
  )
  public final FeatureSet features;

  /**
   * Indicate that fields annotated with this enum value should not be printed
   * out when using debug formats, e.g. when the field contains sensitive
   * credentials.
   */
  @WireField(
      tag = 3,
      adapter = "com.squareup.wire.ProtoAdapter#BOOL"
  )
  public final Boolean debug_redact;

  /**
   * The parser stores options it doesn't recognize here. See above.
   */
  @WireField(
      tag = 999,
      adapter = "com.google.protobuf.UninterpretedOption#ADAPTER",
      label = WireField.Label.REPEATED
  )
  public final List uninterpreted_option;

  public EnumValueOptions(Boolean deprecated, FeatureSet features, Boolean debug_redact,
      List uninterpreted_option) {
    this(deprecated, features, debug_redact, uninterpreted_option, ByteString.EMPTY);
  }

  public EnumValueOptions(Boolean deprecated, FeatureSet features, Boolean debug_redact,
      List uninterpreted_option, ByteString unknownFields) {
    super(ADAPTER, unknownFields);
    this.deprecated = deprecated;
    this.features = features;
    this.debug_redact = debug_redact;
    this.uninterpreted_option = Internal.immutableCopyOf("uninterpreted_option", uninterpreted_option);
  }

  @Override
  public Builder newBuilder() {
    Builder builder = new Builder();
    builder.deprecated = deprecated;
    builder.features = features;
    builder.debug_redact = debug_redact;
    builder.uninterpreted_option = Internal.copyOf(uninterpreted_option);
    builder.addUnknownFields(unknownFields());
    return builder;
  }

  @Override
  public boolean equals(Object other) {
    if (other == this) return true;
    if (!(other instanceof EnumValueOptions)) return false;
    EnumValueOptions o = (EnumValueOptions) other;
    return unknownFields().equals(o.unknownFields())
        && Internal.equals(deprecated, o.deprecated)
        && Internal.equals(features, o.features)
        && Internal.equals(debug_redact, o.debug_redact)
        && uninterpreted_option.equals(o.uninterpreted_option);
  }

  @Override
  public int hashCode() {
    int result = super.hashCode;
    if (result == 0) {
      result = unknownFields().hashCode();
      result = result * 37 + (deprecated != null ? deprecated.hashCode() : 0);
      result = result * 37 + (features != null ? features.hashCode() : 0);
      result = result * 37 + (debug_redact != null ? debug_redact.hashCode() : 0);
      result = result * 37 + uninterpreted_option.hashCode();
      super.hashCode = result;
    }
    return result;
  }

  @Override
  public String toString() {
    StringBuilder builder = new StringBuilder();
    if (deprecated != null) builder.append(", deprecated=").append(deprecated);
    if (features != null) builder.append(", features=").append(features);
    if (debug_redact != null) builder.append(", debug_redact=").append(debug_redact);
    if (!uninterpreted_option.isEmpty()) builder.append(", uninterpreted_option=").append(uninterpreted_option);
    return builder.replace(0, 2, "EnumValueOptions{").append('}').toString();
  }

  public static final class Builder extends Message.Builder {
    public Boolean deprecated;

    public FeatureSet features;

    public Boolean debug_redact;

    public List uninterpreted_option;

    public Builder() {
      uninterpreted_option = Internal.newMutableList();
    }

    /**
     * Is this enum value deprecated?
     * Depending on the target platform, this can emit Deprecated annotations
     * for the enum value, or it will be completely ignored; in the very least,
     * this is a formalization for deprecating enum values.
     */
    public Builder deprecated(Boolean deprecated) {
      this.deprecated = deprecated;
      return this;
    }

    /**
     * Any features defined in the specific edition.
     */
    public Builder features(FeatureSet features) {
      this.features = features;
      return this;
    }

    /**
     * Indicate that fields annotated with this enum value should not be printed
     * out when using debug formats, e.g. when the field contains sensitive
     * credentials.
     */
    public Builder debug_redact(Boolean debug_redact) {
      this.debug_redact = debug_redact;
      return this;
    }

    /**
     * The parser stores options it doesn't recognize here. See above.
     */
    public Builder uninterpreted_option(List uninterpreted_option) {
      Internal.checkElementsNotNull(uninterpreted_option);
      this.uninterpreted_option = uninterpreted_option;
      return this;
    }

    @Override
    public EnumValueOptions build() {
      return new EnumValueOptions(deprecated, features, debug_redact, uninterpreted_option, super.buildUnknownFields());
    }
  }

  private static final class ProtoAdapter_EnumValueOptions extends ProtoAdapter {
    public ProtoAdapter_EnumValueOptions() {
      super(FieldEncoding.LENGTH_DELIMITED, EnumValueOptions.class, "type.googleapis.com/google.protobuf.EnumValueOptions", Syntax.PROTO_2, null, "google/protobuf/descriptor.proto");
    }

    @Override
    public int encodedSize(EnumValueOptions value) {
      int result = 0;
      result += ProtoAdapter.BOOL.encodedSizeWithTag(1, value.deprecated);
      result += FeatureSet.ADAPTER.encodedSizeWithTag(2, value.features);
      result += ProtoAdapter.BOOL.encodedSizeWithTag(3, value.debug_redact);
      result += UninterpretedOption.ADAPTER.asRepeated().encodedSizeWithTag(999, value.uninterpreted_option);
      result += value.unknownFields().size();
      return result;
    }

    @Override
    public void encode(ProtoWriter writer, EnumValueOptions value) throws IOException {
      ProtoAdapter.BOOL.encodeWithTag(writer, 1, value.deprecated);
      FeatureSet.ADAPTER.encodeWithTag(writer, 2, value.features);
      ProtoAdapter.BOOL.encodeWithTag(writer, 3, value.debug_redact);
      UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
      writer.writeBytes(value.unknownFields());
    }

    @Override
    public void encode(ReverseProtoWriter writer, EnumValueOptions value) throws IOException {
      writer.writeBytes(value.unknownFields());
      UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
      ProtoAdapter.BOOL.encodeWithTag(writer, 3, value.debug_redact);
      FeatureSet.ADAPTER.encodeWithTag(writer, 2, value.features);
      ProtoAdapter.BOOL.encodeWithTag(writer, 1, value.deprecated);
    }

    @Override
    public EnumValueOptions decode(ProtoReader reader) throws IOException {
      Builder builder = new Builder();
      long token = reader.beginMessage();
      for (int tag; (tag = reader.nextTag()) != -1;) {
        switch (tag) {
          case 1: builder.deprecated(ProtoAdapter.BOOL.decode(reader)); break;
          case 2: builder.features(FeatureSet.ADAPTER.decode(reader)); break;
          case 3: builder.debug_redact(ProtoAdapter.BOOL.decode(reader)); break;
          case 999: builder.uninterpreted_option.add(UninterpretedOption.ADAPTER.decode(reader)); break;
          default: {
            reader.readUnknownField(tag);
          }
        }
      }
      builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token));
      return builder.build();
    }

    @Override
    public EnumValueOptions redact(EnumValueOptions value) {
      Builder builder = value.newBuilder();
      if (builder.features != null) builder.features = FeatureSet.ADAPTER.redact(builder.features);
      Internal.redactElements(builder.uninterpreted_option, UninterpretedOption.ADAPTER);
      builder.clearUnknownFields();
      return builder.build();
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy