com.google.protobuf.FeatureSet 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.EnumAdapter;
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.WireEnum;
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 okio.ByteString;
/**
* ===================================================================
* Features
* TODO Enums in C++ gencode (and potentially other languages) are
* not well scoped. This means that each of the feature enums below can clash
* with each other. The short names we've chosen maximize call-site
* readability, but leave us very open to this scenario. A future feature will
* be designed and implemented to handle this, hopefully before we ever hit a
* conflict here.
*/
public final class FeatureSet extends Message {
public static final ProtoAdapter ADAPTER = new ProtoAdapter_FeatureSet();
private static final long serialVersionUID = 0L;
public static final FieldPresence DEFAULT_FIELD_PRESENCE = FieldPresence.FIELD_PRESENCE_UNKNOWN;
public static final EnumType DEFAULT_ENUM_TYPE = EnumType.ENUM_TYPE_UNKNOWN;
public static final RepeatedFieldEncoding DEFAULT_REPEATED_FIELD_ENCODING = RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN;
public static final Utf8Validation DEFAULT_UTF8_VALIDATION = Utf8Validation.UTF8_VALIDATION_UNKNOWN;
public static final MessageEncoding DEFAULT_MESSAGE_ENCODING = MessageEncoding.MESSAGE_ENCODING_UNKNOWN;
public static final JsonFormat DEFAULT_JSON_FORMAT = JsonFormat.JSON_FORMAT_UNKNOWN;
@WireField(
tag = 1,
adapter = "com.google.protobuf.FeatureSet$FieldPresence#ADAPTER"
)
public final FieldPresence field_presence;
@WireField(
tag = 2,
adapter = "com.google.protobuf.FeatureSet$EnumType#ADAPTER"
)
public final EnumType enum_type;
@WireField(
tag = 3,
adapter = "com.google.protobuf.FeatureSet$RepeatedFieldEncoding#ADAPTER"
)
public final RepeatedFieldEncoding repeated_field_encoding;
@WireField(
tag = 4,
adapter = "com.google.protobuf.FeatureSet$Utf8Validation#ADAPTER"
)
public final Utf8Validation utf8_validation;
@WireField(
tag = 5,
adapter = "com.google.protobuf.FeatureSet$MessageEncoding#ADAPTER"
)
public final MessageEncoding message_encoding;
@WireField(
tag = 6,
adapter = "com.google.protobuf.FeatureSet$JsonFormat#ADAPTER"
)
public final JsonFormat json_format;
public FeatureSet(FieldPresence field_presence, EnumType enum_type,
RepeatedFieldEncoding repeated_field_encoding, Utf8Validation utf8_validation,
MessageEncoding message_encoding, JsonFormat json_format) {
this(field_presence, enum_type, repeated_field_encoding, utf8_validation, message_encoding, json_format, ByteString.EMPTY);
}
public FeatureSet(FieldPresence field_presence, EnumType enum_type,
RepeatedFieldEncoding repeated_field_encoding, Utf8Validation utf8_validation,
MessageEncoding message_encoding, JsonFormat json_format, ByteString unknownFields) {
super(ADAPTER, unknownFields);
this.field_presence = field_presence;
this.enum_type = enum_type;
this.repeated_field_encoding = repeated_field_encoding;
this.utf8_validation = utf8_validation;
this.message_encoding = message_encoding;
this.json_format = json_format;
}
@Override
public Builder newBuilder() {
Builder builder = new Builder();
builder.field_presence = field_presence;
builder.enum_type = enum_type;
builder.repeated_field_encoding = repeated_field_encoding;
builder.utf8_validation = utf8_validation;
builder.message_encoding = message_encoding;
builder.json_format = json_format;
builder.addUnknownFields(unknownFields());
return builder;
}
@Override
public boolean equals(Object other) {
if (other == this) return true;
if (!(other instanceof FeatureSet)) return false;
FeatureSet o = (FeatureSet) other;
return unknownFields().equals(o.unknownFields())
&& Internal.equals(field_presence, o.field_presence)
&& Internal.equals(enum_type, o.enum_type)
&& Internal.equals(repeated_field_encoding, o.repeated_field_encoding)
&& Internal.equals(utf8_validation, o.utf8_validation)
&& Internal.equals(message_encoding, o.message_encoding)
&& Internal.equals(json_format, o.json_format);
}
@Override
public int hashCode() {
int result = super.hashCode;
if (result == 0) {
result = unknownFields().hashCode();
result = result * 37 + (field_presence != null ? field_presence.hashCode() : 0);
result = result * 37 + (enum_type != null ? enum_type.hashCode() : 0);
result = result * 37 + (repeated_field_encoding != null ? repeated_field_encoding.hashCode() : 0);
result = result * 37 + (utf8_validation != null ? utf8_validation.hashCode() : 0);
result = result * 37 + (message_encoding != null ? message_encoding.hashCode() : 0);
result = result * 37 + (json_format != null ? json_format.hashCode() : 0);
super.hashCode = result;
}
return result;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
if (field_presence != null) builder.append(", field_presence=").append(field_presence);
if (enum_type != null) builder.append(", enum_type=").append(enum_type);
if (repeated_field_encoding != null) builder.append(", repeated_field_encoding=").append(repeated_field_encoding);
if (utf8_validation != null) builder.append(", utf8_validation=").append(utf8_validation);
if (message_encoding != null) builder.append(", message_encoding=").append(message_encoding);
if (json_format != null) builder.append(", json_format=").append(json_format);
return builder.replace(0, 2, "FeatureSet{").append('}').toString();
}
public static final class Builder extends Message.Builder {
public FieldPresence field_presence;
public EnumType enum_type;
public RepeatedFieldEncoding repeated_field_encoding;
public Utf8Validation utf8_validation;
public MessageEncoding message_encoding;
public JsonFormat json_format;
public Builder() {
}
public Builder field_presence(FieldPresence field_presence) {
this.field_presence = field_presence;
return this;
}
public Builder enum_type(EnumType enum_type) {
this.enum_type = enum_type;
return this;
}
public Builder repeated_field_encoding(RepeatedFieldEncoding repeated_field_encoding) {
this.repeated_field_encoding = repeated_field_encoding;
return this;
}
public Builder utf8_validation(Utf8Validation utf8_validation) {
this.utf8_validation = utf8_validation;
return this;
}
public Builder message_encoding(MessageEncoding message_encoding) {
this.message_encoding = message_encoding;
return this;
}
public Builder json_format(JsonFormat json_format) {
this.json_format = json_format;
return this;
}
@Override
public FeatureSet build() {
return new FeatureSet(field_presence, enum_type, repeated_field_encoding, utf8_validation, message_encoding, json_format, super.buildUnknownFields());
}
}
public enum FieldPresence implements WireEnum {
FIELD_PRESENCE_UNKNOWN(0),
EXPLICIT(1),
IMPLICIT(2),
LEGACY_REQUIRED(3);
public static final ProtoAdapter ADAPTER = new ProtoAdapter_FieldPresence();
private final int value;
FieldPresence(int value) {
this.value = value;
}
/**
* Return the constant for {@code value} or null.
*/
public static FieldPresence fromValue(int value) {
switch (value) {
case 0: return FIELD_PRESENCE_UNKNOWN;
case 1: return EXPLICIT;
case 2: return IMPLICIT;
case 3: return LEGACY_REQUIRED;
default: return null;
}
}
@Override
public int getValue() {
return value;
}
private static final class ProtoAdapter_FieldPresence extends EnumAdapter {
ProtoAdapter_FieldPresence() {
super(FieldPresence.class, Syntax.PROTO_2, FieldPresence.FIELD_PRESENCE_UNKNOWN);
}
@Override
protected FieldPresence fromValue(int value) {
return FieldPresence.fromValue(value);
}
}
}
public enum EnumType implements WireEnum {
ENUM_TYPE_UNKNOWN(0),
OPEN(1),
CLOSED(2);
public static final ProtoAdapter ADAPTER = new ProtoAdapter_EnumType();
private final int value;
EnumType(int value) {
this.value = value;
}
/**
* Return the constant for {@code value} or null.
*/
public static EnumType fromValue(int value) {
switch (value) {
case 0: return ENUM_TYPE_UNKNOWN;
case 1: return OPEN;
case 2: return CLOSED;
default: return null;
}
}
@Override
public int getValue() {
return value;
}
private static final class ProtoAdapter_EnumType extends EnumAdapter {
ProtoAdapter_EnumType() {
super(EnumType.class, Syntax.PROTO_2, EnumType.ENUM_TYPE_UNKNOWN);
}
@Override
protected EnumType fromValue(int value) {
return EnumType.fromValue(value);
}
}
}
public enum RepeatedFieldEncoding implements WireEnum {
REPEATED_FIELD_ENCODING_UNKNOWN(0),
PACKED(1),
EXPANDED(2);
public static final ProtoAdapter ADAPTER = new ProtoAdapter_RepeatedFieldEncoding();
private final int value;
RepeatedFieldEncoding(int value) {
this.value = value;
}
/**
* Return the constant for {@code value} or null.
*/
public static RepeatedFieldEncoding fromValue(int value) {
switch (value) {
case 0: return REPEATED_FIELD_ENCODING_UNKNOWN;
case 1: return PACKED;
case 2: return EXPANDED;
default: return null;
}
}
@Override
public int getValue() {
return value;
}
private static final class ProtoAdapter_RepeatedFieldEncoding extends EnumAdapter {
ProtoAdapter_RepeatedFieldEncoding() {
super(RepeatedFieldEncoding.class, Syntax.PROTO_2, RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN);
}
@Override
protected RepeatedFieldEncoding fromValue(int value) {
return RepeatedFieldEncoding.fromValue(value);
}
}
}
public enum Utf8Validation implements WireEnum {
UTF8_VALIDATION_UNKNOWN(0),
NONE(1),
VERIFY(2);
public static final ProtoAdapter ADAPTER = new ProtoAdapter_Utf8Validation();
private final int value;
Utf8Validation(int value) {
this.value = value;
}
/**
* Return the constant for {@code value} or null.
*/
public static Utf8Validation fromValue(int value) {
switch (value) {
case 0: return UTF8_VALIDATION_UNKNOWN;
case 1: return NONE;
case 2: return VERIFY;
default: return null;
}
}
@Override
public int getValue() {
return value;
}
private static final class ProtoAdapter_Utf8Validation extends EnumAdapter {
ProtoAdapter_Utf8Validation() {
super(Utf8Validation.class, Syntax.PROTO_2, Utf8Validation.UTF8_VALIDATION_UNKNOWN);
}
@Override
protected Utf8Validation fromValue(int value) {
return Utf8Validation.fromValue(value);
}
}
}
public enum MessageEncoding implements WireEnum {
MESSAGE_ENCODING_UNKNOWN(0),
LENGTH_PREFIXED(1),
DELIMITED(2);
public static final ProtoAdapter ADAPTER = new ProtoAdapter_MessageEncoding();
private final int value;
MessageEncoding(int value) {
this.value = value;
}
/**
* Return the constant for {@code value} or null.
*/
public static MessageEncoding fromValue(int value) {
switch (value) {
case 0: return MESSAGE_ENCODING_UNKNOWN;
case 1: return LENGTH_PREFIXED;
case 2: return DELIMITED;
default: return null;
}
}
@Override
public int getValue() {
return value;
}
private static final class ProtoAdapter_MessageEncoding extends EnumAdapter {
ProtoAdapter_MessageEncoding() {
super(MessageEncoding.class, Syntax.PROTO_2, MessageEncoding.MESSAGE_ENCODING_UNKNOWN);
}
@Override
protected MessageEncoding fromValue(int value) {
return MessageEncoding.fromValue(value);
}
}
}
public enum JsonFormat implements WireEnum {
JSON_FORMAT_UNKNOWN(0),
ALLOW(1),
LEGACY_BEST_EFFORT(2);
public static final ProtoAdapter ADAPTER = new ProtoAdapter_JsonFormat();
private final int value;
JsonFormat(int value) {
this.value = value;
}
/**
* Return the constant for {@code value} or null.
*/
public static JsonFormat fromValue(int value) {
switch (value) {
case 0: return JSON_FORMAT_UNKNOWN;
case 1: return ALLOW;
case 2: return LEGACY_BEST_EFFORT;
default: return null;
}
}
@Override
public int getValue() {
return value;
}
private static final class ProtoAdapter_JsonFormat extends EnumAdapter {
ProtoAdapter_JsonFormat() {
super(JsonFormat.class, Syntax.PROTO_2, JsonFormat.JSON_FORMAT_UNKNOWN);
}
@Override
protected JsonFormat fromValue(int value) {
return JsonFormat.fromValue(value);
}
}
}
private static final class ProtoAdapter_FeatureSet extends ProtoAdapter {
public ProtoAdapter_FeatureSet() {
super(FieldEncoding.LENGTH_DELIMITED, FeatureSet.class, "type.googleapis.com/google.protobuf.FeatureSet", Syntax.PROTO_2, null, "google/protobuf/descriptor.proto");
}
@Override
public int encodedSize(FeatureSet value) {
int result = 0;
result += FieldPresence.ADAPTER.encodedSizeWithTag(1, value.field_presence);
result += EnumType.ADAPTER.encodedSizeWithTag(2, value.enum_type);
result += RepeatedFieldEncoding.ADAPTER.encodedSizeWithTag(3, value.repeated_field_encoding);
result += Utf8Validation.ADAPTER.encodedSizeWithTag(4, value.utf8_validation);
result += MessageEncoding.ADAPTER.encodedSizeWithTag(5, value.message_encoding);
result += JsonFormat.ADAPTER.encodedSizeWithTag(6, value.json_format);
result += value.unknownFields().size();
return result;
}
@Override
public void encode(ProtoWriter writer, FeatureSet value) throws IOException {
FieldPresence.ADAPTER.encodeWithTag(writer, 1, value.field_presence);
EnumType.ADAPTER.encodeWithTag(writer, 2, value.enum_type);
RepeatedFieldEncoding.ADAPTER.encodeWithTag(writer, 3, value.repeated_field_encoding);
Utf8Validation.ADAPTER.encodeWithTag(writer, 4, value.utf8_validation);
MessageEncoding.ADAPTER.encodeWithTag(writer, 5, value.message_encoding);
JsonFormat.ADAPTER.encodeWithTag(writer, 6, value.json_format);
writer.writeBytes(value.unknownFields());
}
@Override
public void encode(ReverseProtoWriter writer, FeatureSet value) throws IOException {
writer.writeBytes(value.unknownFields());
JsonFormat.ADAPTER.encodeWithTag(writer, 6, value.json_format);
MessageEncoding.ADAPTER.encodeWithTag(writer, 5, value.message_encoding);
Utf8Validation.ADAPTER.encodeWithTag(writer, 4, value.utf8_validation);
RepeatedFieldEncoding.ADAPTER.encodeWithTag(writer, 3, value.repeated_field_encoding);
EnumType.ADAPTER.encodeWithTag(writer, 2, value.enum_type);
FieldPresence.ADAPTER.encodeWithTag(writer, 1, value.field_presence);
}
@Override
public FeatureSet decode(ProtoReader reader) throws IOException {
Builder builder = new Builder();
long token = reader.beginMessage();
for (int tag; (tag = reader.nextTag()) != -1;) {
switch (tag) {
case 1: {
try {
builder.field_presence(FieldPresence.ADAPTER.decode(reader));
} catch (ProtoAdapter.EnumConstantNotFoundException e) {
builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
}
break;
}
case 2: {
try {
builder.enum_type(EnumType.ADAPTER.decode(reader));
} catch (ProtoAdapter.EnumConstantNotFoundException e) {
builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
}
break;
}
case 3: {
try {
builder.repeated_field_encoding(RepeatedFieldEncoding.ADAPTER.decode(reader));
} catch (ProtoAdapter.EnumConstantNotFoundException e) {
builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
}
break;
}
case 4: {
try {
builder.utf8_validation(Utf8Validation.ADAPTER.decode(reader));
} catch (ProtoAdapter.EnumConstantNotFoundException e) {
builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
}
break;
}
case 5: {
try {
builder.message_encoding(MessageEncoding.ADAPTER.decode(reader));
} catch (ProtoAdapter.EnumConstantNotFoundException e) {
builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
}
break;
}
case 6: {
try {
builder.json_format(JsonFormat.ADAPTER.decode(reader));
} catch (ProtoAdapter.EnumConstantNotFoundException e) {
builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
}
break;
}
default: {
reader.readUnknownField(tag);
}
}
}
builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token));
return builder.build();
}
@Override
public FeatureSet redact(FeatureSet value) {
Builder builder = value.newBuilder();
builder.clearUnknownFields();
return builder.build();
}
}
}