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

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

The 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.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.util.List;
import okio.ByteString;

public final class OneofOptions extends Message {
  public static final ProtoAdapter ADAPTER = new ProtoAdapter_OneofOptions();

  private static final long serialVersionUID = 0L;

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

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

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

  public static final class Builder extends Message.Builder {
    public FeatureSet features;

    public List uninterpreted_option;

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

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

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

    @Override
    public int encodedSize(OneofOptions value) {
      int result = 0;
      result += FeatureSet.ADAPTER.encodedSizeWithTag(1, value.features);
      result += UninterpretedOption.ADAPTER.asRepeated().encodedSizeWithTag(999, value.uninterpreted_option);
      result += value.unknownFields().size();
      return result;
    }

    @Override
    public void encode(ProtoWriter writer, OneofOptions value) throws IOException {
      FeatureSet.ADAPTER.encodeWithTag(writer, 1, value.features);
      UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
      writer.writeBytes(value.unknownFields());
    }

    @Override
    public void encode(ReverseProtoWriter writer, OneofOptions value) throws IOException {
      writer.writeBytes(value.unknownFields());
      UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
      FeatureSet.ADAPTER.encodeWithTag(writer, 1, value.features);
    }

    @Override
    public OneofOptions 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.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 OneofOptions redact(OneofOptions 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