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

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

  private static final long serialVersionUID = 0L;

  public static final Boolean DEFAULT_DEPRECATED = false;

  /**
   * Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
   *   framework.  We apologize for hoarding these numbers to ourselves, but
   *   we were already using them long before we decided to release Protocol
   *   Buffers.
   * Is this method deprecated?
   * Depending on the target platform, this can emit Deprecated annotations
   * for the method, or it will be completely ignored; in the very least,
   * this is a formalization for deprecating methods.
   */
  @WireField(
      tag = 33,
      adapter = "com.squareup.wire.ProtoAdapter#BOOL"
  )
  public final Boolean deprecated;

  /**
   * Any features defined in the specific edition.
   */
  @WireField(
      tag = 35,
      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 MethodOptions(Boolean deprecated, FeatureSet features,
      List uninterpreted_option) {
    this(deprecated, features, uninterpreted_option, ByteString.EMPTY);
  }

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

  @Override
  public Builder newBuilder() {
    Builder builder = new Builder();
    builder.deprecated = deprecated;
    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 MethodOptions)) return false;
    MethodOptions o = (MethodOptions) other;
    return unknownFields().equals(o.unknownFields())
        && Internal.equals(deprecated, o.deprecated)
        && 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 + (deprecated != null ? deprecated.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 (deprecated != null) builder.append(", deprecated=").append(deprecated);
    if (features != null) builder.append(", features=").append(features);
    if (!uninterpreted_option.isEmpty()) builder.append(", uninterpreted_option=").append(uninterpreted_option);
    return builder.replace(0, 2, "MethodOptions{").append('}').toString();
  }

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

    public FeatureSet features;

    public List uninterpreted_option;

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

    /**
     * Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
     *   framework.  We apologize for hoarding these numbers to ourselves, but
     *   we were already using them long before we decided to release Protocol
     *   Buffers.
     * Is this method deprecated?
     * Depending on the target platform, this can emit Deprecated annotations
     * for the method, or it will be completely ignored; in the very least,
     * this is a formalization for deprecating methods.
     */
    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;
    }

    /**
     * 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 MethodOptions build() {
      return new MethodOptions(deprecated, features, uninterpreted_option, super.buildUnknownFields());
    }
  }

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

    @Override
    public int encodedSize(MethodOptions value) {
      int result = 0;
      result += ProtoAdapter.BOOL.encodedSizeWithTag(33, value.deprecated);
      result += FeatureSet.ADAPTER.encodedSizeWithTag(35, value.features);
      result += UninterpretedOption.ADAPTER.asRepeated().encodedSizeWithTag(999, value.uninterpreted_option);
      result += value.unknownFields().size();
      return result;
    }

    @Override
    public void encode(ProtoWriter writer, MethodOptions value) throws IOException {
      ProtoAdapter.BOOL.encodeWithTag(writer, 33, value.deprecated);
      FeatureSet.ADAPTER.encodeWithTag(writer, 35, value.features);
      UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
      writer.writeBytes(value.unknownFields());
    }

    @Override
    public void encode(ReverseProtoWriter writer, MethodOptions value) throws IOException {
      writer.writeBytes(value.unknownFields());
      UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
      FeatureSet.ADAPTER.encodeWithTag(writer, 35, value.features);
      ProtoAdapter.BOOL.encodeWithTag(writer, 33, value.deprecated);
    }

    @Override
    public MethodOptions decode(ProtoReader reader) throws IOException {
      Builder builder = new Builder();
      long token = reader.beginMessage();
      for (int tag; (tag = reader.nextTag()) != -1;) {
        switch (tag) {
          case 33: builder.deprecated(ProtoAdapter.BOOL.decode(reader)); break;
          case 35: 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 MethodOptions redact(MethodOptions 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