com.google.protobuf.UninterpretedOption 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.Boolean;
import java.lang.Double;
import java.lang.Long;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.util.List;
import okio.ByteString;
/**
* A message representing a option the parser does not recognize. This only
* appears in options protos created by the compiler::Parser class.
* DescriptorPool resolves these when building Descriptor objects. Therefore,
* options protos in descriptor objects (e.g. returned by Descriptor::options(),
* or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
* in them.
*/
public final class UninterpretedOption extends Message {
public static final ProtoAdapter ADAPTER = new ProtoAdapter_UninterpretedOption();
private static final long serialVersionUID = 0L;
public static final String DEFAULT_IDENTIFIER_VALUE = "";
public static final Long DEFAULT_POSITIVE_INT_VALUE = 0L;
public static final Long DEFAULT_NEGATIVE_INT_VALUE = 0L;
public static final Double DEFAULT_DOUBLE_VALUE = 0.0d;
public static final ByteString DEFAULT_STRING_VALUE = ByteString.EMPTY;
public static final String DEFAULT_AGGREGATE_VALUE = "";
@WireField(
tag = 2,
adapter = "com.google.protobuf.UninterpretedOption$NamePart#ADAPTER",
label = WireField.Label.REPEATED
)
public final List name;
/**
* The value of the uninterpreted option, in whatever type the tokenizer
* identified it as during parsing. Exactly one of these should be set.
*/
@WireField(
tag = 3,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String identifier_value;
@WireField(
tag = 4,
adapter = "com.squareup.wire.ProtoAdapter#UINT64"
)
public final Long positive_int_value;
@WireField(
tag = 5,
adapter = "com.squareup.wire.ProtoAdapter#INT64"
)
public final Long negative_int_value;
@WireField(
tag = 6,
adapter = "com.squareup.wire.ProtoAdapter#DOUBLE"
)
public final Double double_value;
@WireField(
tag = 7,
adapter = "com.squareup.wire.ProtoAdapter#BYTES"
)
public final ByteString string_value;
@WireField(
tag = 8,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String aggregate_value;
public UninterpretedOption(List name, String identifier_value, Long positive_int_value,
Long negative_int_value, Double double_value, ByteString string_value,
String aggregate_value) {
this(name, identifier_value, positive_int_value, negative_int_value, double_value, string_value, aggregate_value, ByteString.EMPTY);
}
public UninterpretedOption(List name, String identifier_value, Long positive_int_value,
Long negative_int_value, Double double_value, ByteString string_value, String aggregate_value,
ByteString unknownFields) {
super(ADAPTER, unknownFields);
this.name = Internal.immutableCopyOf("name", name);
this.identifier_value = identifier_value;
this.positive_int_value = positive_int_value;
this.negative_int_value = negative_int_value;
this.double_value = double_value;
this.string_value = string_value;
this.aggregate_value = aggregate_value;
}
@Override
public Builder newBuilder() {
Builder builder = new Builder();
builder.name = Internal.copyOf(name);
builder.identifier_value = identifier_value;
builder.positive_int_value = positive_int_value;
builder.negative_int_value = negative_int_value;
builder.double_value = double_value;
builder.string_value = string_value;
builder.aggregate_value = aggregate_value;
builder.addUnknownFields(unknownFields());
return builder;
}
@Override
public boolean equals(Object other) {
if (other == this) return true;
if (!(other instanceof UninterpretedOption)) return false;
UninterpretedOption o = (UninterpretedOption) other;
return unknownFields().equals(o.unknownFields())
&& name.equals(o.name)
&& Internal.equals(identifier_value, o.identifier_value)
&& Internal.equals(positive_int_value, o.positive_int_value)
&& Internal.equals(negative_int_value, o.negative_int_value)
&& Internal.equals(double_value, o.double_value)
&& Internal.equals(string_value, o.string_value)
&& Internal.equals(aggregate_value, o.aggregate_value);
}
@Override
public int hashCode() {
int result = super.hashCode;
if (result == 0) {
result = unknownFields().hashCode();
result = result * 37 + name.hashCode();
result = result * 37 + (identifier_value != null ? identifier_value.hashCode() : 0);
result = result * 37 + (positive_int_value != null ? positive_int_value.hashCode() : 0);
result = result * 37 + (negative_int_value != null ? negative_int_value.hashCode() : 0);
result = result * 37 + (double_value != null ? double_value.hashCode() : 0);
result = result * 37 + (string_value != null ? string_value.hashCode() : 0);
result = result * 37 + (aggregate_value != null ? aggregate_value.hashCode() : 0);
super.hashCode = result;
}
return result;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
if (!name.isEmpty()) builder.append(", name=").append(name);
if (identifier_value != null) builder.append(", identifier_value=").append(Internal.sanitize(identifier_value));
if (positive_int_value != null) builder.append(", positive_int_value=").append(positive_int_value);
if (negative_int_value != null) builder.append(", negative_int_value=").append(negative_int_value);
if (double_value != null) builder.append(", double_value=").append(double_value);
if (string_value != null) builder.append(", string_value=").append(string_value);
if (aggregate_value != null) builder.append(", aggregate_value=").append(Internal.sanitize(aggregate_value));
return builder.replace(0, 2, "UninterpretedOption{").append('}').toString();
}
public static final class Builder extends Message.Builder {
public List name;
public String identifier_value;
public Long positive_int_value;
public Long negative_int_value;
public Double double_value;
public ByteString string_value;
public String aggregate_value;
public Builder() {
name = Internal.newMutableList();
}
public Builder name(List name) {
Internal.checkElementsNotNull(name);
this.name = name;
return this;
}
/**
* The value of the uninterpreted option, in whatever type the tokenizer
* identified it as during parsing. Exactly one of these should be set.
*/
public Builder identifier_value(String identifier_value) {
this.identifier_value = identifier_value;
return this;
}
public Builder positive_int_value(Long positive_int_value) {
this.positive_int_value = positive_int_value;
return this;
}
public Builder negative_int_value(Long negative_int_value) {
this.negative_int_value = negative_int_value;
return this;
}
public Builder double_value(Double double_value) {
this.double_value = double_value;
return this;
}
public Builder string_value(ByteString string_value) {
this.string_value = string_value;
return this;
}
public Builder aggregate_value(String aggregate_value) {
this.aggregate_value = aggregate_value;
return this;
}
@Override
public UninterpretedOption build() {
return new UninterpretedOption(name, identifier_value, positive_int_value, negative_int_value, double_value, string_value, aggregate_value, super.buildUnknownFields());
}
}
/**
* The name of the uninterpreted option. Each string represents a segment in
* a dot-separated name. is_extension is true iff a segment represents an
* extension (denoted with parentheses in options specs in .proto files).
* E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
* "foo.(bar.baz).moo".
*/
public static final class NamePart extends Message {
public static final ProtoAdapter ADAPTER = new ProtoAdapter_NamePart();
private static final long serialVersionUID = 0L;
public static final String DEFAULT_NAME_PART = "";
public static final Boolean DEFAULT_IS_EXTENSION = false;
@WireField(
tag = 1,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
label = WireField.Label.REQUIRED
)
public final String name_part;
@WireField(
tag = 2,
adapter = "com.squareup.wire.ProtoAdapter#BOOL",
label = WireField.Label.REQUIRED
)
public final Boolean is_extension;
public NamePart(String name_part, Boolean is_extension) {
this(name_part, is_extension, ByteString.EMPTY);
}
public NamePart(String name_part, Boolean is_extension, ByteString unknownFields) {
super(ADAPTER, unknownFields);
this.name_part = name_part;
this.is_extension = is_extension;
}
@Override
public Builder newBuilder() {
Builder builder = new Builder();
builder.name_part = name_part;
builder.is_extension = is_extension;
builder.addUnknownFields(unknownFields());
return builder;
}
@Override
public boolean equals(Object other) {
if (other == this) return true;
if (!(other instanceof NamePart)) return false;
NamePart o = (NamePart) other;
return unknownFields().equals(o.unknownFields())
&& name_part.equals(o.name_part)
&& is_extension.equals(o.is_extension);
}
@Override
public int hashCode() {
int result = super.hashCode;
if (result == 0) {
result = unknownFields().hashCode();
result = result * 37 + name_part.hashCode();
result = result * 37 + is_extension.hashCode();
super.hashCode = result;
}
return result;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append(", name_part=").append(Internal.sanitize(name_part));
builder.append(", is_extension=").append(is_extension);
return builder.replace(0, 2, "NamePart{").append('}').toString();
}
public static final class Builder extends Message.Builder {
public String name_part;
public Boolean is_extension;
public Builder() {
}
public Builder name_part(String name_part) {
this.name_part = name_part;
return this;
}
public Builder is_extension(Boolean is_extension) {
this.is_extension = is_extension;
return this;
}
@Override
public NamePart build() {
if (name_part == null
|| is_extension == null) {
throw Internal.missingRequiredFields(name_part, "name_part",
is_extension, "is_extension");
}
return new NamePart(name_part, is_extension, super.buildUnknownFields());
}
}
private static final class ProtoAdapter_NamePart extends ProtoAdapter {
public ProtoAdapter_NamePart() {
super(FieldEncoding.LENGTH_DELIMITED, NamePart.class, "type.googleapis.com/google.protobuf.UninterpretedOption.NamePart", Syntax.PROTO_2, null, "google/protobuf/descriptor.proto");
}
@Override
public int encodedSize(NamePart value) {
int result = 0;
result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.name_part);
result += ProtoAdapter.BOOL.encodedSizeWithTag(2, value.is_extension);
result += value.unknownFields().size();
return result;
}
@Override
public void encode(ProtoWriter writer, NamePart value) throws IOException {
ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name_part);
ProtoAdapter.BOOL.encodeWithTag(writer, 2, value.is_extension);
writer.writeBytes(value.unknownFields());
}
@Override
public void encode(ReverseProtoWriter writer, NamePart value) throws IOException {
writer.writeBytes(value.unknownFields());
ProtoAdapter.BOOL.encodeWithTag(writer, 2, value.is_extension);
ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name_part);
}
@Override
public NamePart 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.name_part(ProtoAdapter.STRING.decode(reader)); break;
case 2: builder.is_extension(ProtoAdapter.BOOL.decode(reader)); break;
default: {
reader.readUnknownField(tag);
}
}
}
builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token));
return builder.build();
}
@Override
public NamePart redact(NamePart value) {
Builder builder = value.newBuilder();
builder.clearUnknownFields();
return builder.build();
}
}
}
private static final class ProtoAdapter_UninterpretedOption extends ProtoAdapter {
public ProtoAdapter_UninterpretedOption() {
super(FieldEncoding.LENGTH_DELIMITED, UninterpretedOption.class, "type.googleapis.com/google.protobuf.UninterpretedOption", Syntax.PROTO_2, null, "google/protobuf/descriptor.proto");
}
@Override
public int encodedSize(UninterpretedOption value) {
int result = 0;
result += NamePart.ADAPTER.asRepeated().encodedSizeWithTag(2, value.name);
result += ProtoAdapter.STRING.encodedSizeWithTag(3, value.identifier_value);
result += ProtoAdapter.UINT64.encodedSizeWithTag(4, value.positive_int_value);
result += ProtoAdapter.INT64.encodedSizeWithTag(5, value.negative_int_value);
result += ProtoAdapter.DOUBLE.encodedSizeWithTag(6, value.double_value);
result += ProtoAdapter.BYTES.encodedSizeWithTag(7, value.string_value);
result += ProtoAdapter.STRING.encodedSizeWithTag(8, value.aggregate_value);
result += value.unknownFields().size();
return result;
}
@Override
public void encode(ProtoWriter writer, UninterpretedOption value) throws IOException {
NamePart.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.name);
ProtoAdapter.STRING.encodeWithTag(writer, 3, value.identifier_value);
ProtoAdapter.UINT64.encodeWithTag(writer, 4, value.positive_int_value);
ProtoAdapter.INT64.encodeWithTag(writer, 5, value.negative_int_value);
ProtoAdapter.DOUBLE.encodeWithTag(writer, 6, value.double_value);
ProtoAdapter.BYTES.encodeWithTag(writer, 7, value.string_value);
ProtoAdapter.STRING.encodeWithTag(writer, 8, value.aggregate_value);
writer.writeBytes(value.unknownFields());
}
@Override
public void encode(ReverseProtoWriter writer, UninterpretedOption value) throws IOException {
writer.writeBytes(value.unknownFields());
ProtoAdapter.STRING.encodeWithTag(writer, 8, value.aggregate_value);
ProtoAdapter.BYTES.encodeWithTag(writer, 7, value.string_value);
ProtoAdapter.DOUBLE.encodeWithTag(writer, 6, value.double_value);
ProtoAdapter.INT64.encodeWithTag(writer, 5, value.negative_int_value);
ProtoAdapter.UINT64.encodeWithTag(writer, 4, value.positive_int_value);
ProtoAdapter.STRING.encodeWithTag(writer, 3, value.identifier_value);
NamePart.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.name);
}
@Override
public UninterpretedOption 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.name.add(NamePart.ADAPTER.decode(reader)); break;
case 3: builder.identifier_value(ProtoAdapter.STRING.decode(reader)); break;
case 4: builder.positive_int_value(ProtoAdapter.UINT64.decode(reader)); break;
case 5: builder.negative_int_value(ProtoAdapter.INT64.decode(reader)); break;
case 6: builder.double_value(ProtoAdapter.DOUBLE.decode(reader)); break;
case 7: builder.string_value(ProtoAdapter.BYTES.decode(reader)); break;
case 8: builder.aggregate_value(ProtoAdapter.STRING.decode(reader)); break;
default: {
reader.readUnknownField(tag);
}
}
}
builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token));
return builder.build();
}
@Override
public UninterpretedOption redact(UninterpretedOption value) {
Builder builder = value.newBuilder();
Internal.redactElements(builder.name, NamePart.ADAPTER);
builder.clearUnknownFields();
return builder.build();
}
}
}