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

com.google.protobuf.EnumOptions 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.Deprecated;
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 EnumOptions extends Message {
  public static final ProtoAdapter ADAPTER = new ProtoAdapter_EnumOptions();

  private static final long serialVersionUID = 0L;

  public static final Boolean DEFAULT_ALLOW_ALIAS = false;

  public static final Boolean DEFAULT_DEPRECATED = false;

  public static final Boolean DEFAULT_DEPRECATED_LEGACY_JSON_FIELD_CONFLICTS = false;

  /**
   * Set this option to true to allow mapping different tag names to the same
   * value.
   */
  @WireField(
      tag = 2,
      adapter = "com.squareup.wire.ProtoAdapter#BOOL"
  )
  public final Boolean allow_alias;

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

  /**
   * Enable the legacy handling of JSON field name conflicts.  This lowercases
   * and strips underscored from the fields before comparison in proto3 only.
   * The new behavior takes `json_name` into account and applies to proto2 as
   * well.
   * TODO Remove this legacy behavior once downstream teams have
   * had time to migrate.
   */
  @WireField(
      tag = 6,
      adapter = "com.squareup.wire.ProtoAdapter#BOOL"
  )
  @Deprecated
  public final Boolean deprecated_legacy_json_field_conflicts;

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

  /**
   * 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 EnumOptions(Boolean allow_alias, Boolean deprecated,
      Boolean deprecated_legacy_json_field_conflicts, FeatureSet features,
      List uninterpreted_option) {
    this(allow_alias, deprecated, deprecated_legacy_json_field_conflicts, features, uninterpreted_option, ByteString.EMPTY);
  }

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

  @Override
  public Builder newBuilder() {
    Builder builder = new Builder();
    builder.allow_alias = allow_alias;
    builder.deprecated = deprecated;
    builder.deprecated_legacy_json_field_conflicts = deprecated_legacy_json_field_conflicts;
    builder.features = features;
    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 EnumOptions)) return false;
    EnumOptions o = (EnumOptions) other;
    return unknownFields().equals(o.unknownFields())
        && Internal.equals(allow_alias, o.allow_alias)
        && Internal.equals(deprecated, o.deprecated)
        && Internal.equals(deprecated_legacy_json_field_conflicts, o.deprecated_legacy_json_field_conflicts)
        && Internal.equals(features, o.features)
        && uninterpreted_option.equals(o.uninterpreted_option);
  }

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

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

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

    public Boolean deprecated;

    public Boolean deprecated_legacy_json_field_conflicts;

    public FeatureSet features;

    public List uninterpreted_option;

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

    /**
     * Set this option to true to allow mapping different tag names to the same
     * value.
     */
    public Builder allow_alias(Boolean allow_alias) {
      this.allow_alias = allow_alias;
      return this;
    }

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

    /**
     * Enable the legacy handling of JSON field name conflicts.  This lowercases
     * and strips underscored from the fields before comparison in proto3 only.
     * The new behavior takes `json_name` into account and applies to proto2 as
     * well.
     * TODO Remove this legacy behavior once downstream teams have
     * had time to migrate.
     */
    @Deprecated
    public Builder deprecated_legacy_json_field_conflicts(
        Boolean deprecated_legacy_json_field_conflicts) {
      this.deprecated_legacy_json_field_conflicts = deprecated_legacy_json_field_conflicts;
      return this;
    }

    /**
     * Any features defined in the specific edition.
     */
    public Builder features(FeatureSet features) {
      this.features = features;
      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 EnumOptions build() {
      return new EnumOptions(allow_alias, deprecated, deprecated_legacy_json_field_conflicts, features, uninterpreted_option, super.buildUnknownFields());
    }
  }

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

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

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

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

    @Override
    public EnumOptions decode(ProtoReader reader) throws IOException {
      Builder builder = new Builder();
      long token = reader.beginMessage();
      for (int tag; (tag = reader.nextTag()) != -1;) {
        switch (tag) {
          case 2: builder.allow_alias(ProtoAdapter.BOOL.decode(reader)); break;
          case 3: builder.deprecated(ProtoAdapter.BOOL.decode(reader)); break;
          case 6: builder.deprecated_legacy_json_field_conflicts(ProtoAdapter.BOOL.decode(reader)); break;
          case 7: builder.features(FeatureSet.ADAPTER.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 EnumOptions redact(EnumOptions 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