From 73c77afb208bf8613e6a572377a15b34f23e4c04 Mon Sep 17 00:00:00 2001 From: Florian Enner Date: Sat, 2 Mar 2024 18:23:35 +0100 Subject: [PATCH] QuickBuffers 1.4 (#93) --- build.gradle | 2 + .../github/fabienrenaud/jjb/JsonBench.java | 5 + .../fabienrenaud/jjb/data/JsonSource.java | 9 + .../jjb/databind/Deserialization.java | 8 + .../jjb/databind/Serialization.java | 7 + .../jjb/model/quickbuf/QuickbufSchema.java | 6292 +++++++++++++++++ .../jjb/provider/ClientsJsonProvider.java | 20 + .../jjb/provider/JsonProvider.java | 7 + .../jjb/provider/UsersJsonProvider.java | 20 + .../jjb/support/BenchSupport.java | 3 +- .../fabienrenaud/jjb/support/Library.java | 3 +- src/main/proto/quickbuf.proto | 93 + .../fabienrenaud/jjb/JsonBenchmark.java | 8 + 13 files changed, 6475 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/github/fabienrenaud/jjb/model/quickbuf/QuickbufSchema.java create mode 100644 src/main/proto/quickbuf.proto diff --git a/build.gradle b/build.gradle index d23e4e3..f9ab475 100644 --- a/build.gradle +++ b/build.gradle @@ -96,6 +96,8 @@ dependencies { implementation group: 'com.github.javadev', name: 'underscore', version: '1.97' // yasson implementation group: 'org.eclipse', name: 'yasson', version: '3.0.3' + // QuickBuffers + implementation group: 'us.hebi.quickbuf', name: 'quickbuf-runtime', version: '1.4' // Test testImplementation group: 'junit', name: 'junit', version: '4.13.2' diff --git a/src/main/java/com/github/fabienrenaud/jjb/JsonBench.java b/src/main/java/com/github/fabienrenaud/jjb/JsonBench.java index 0783490..26a65c0 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/JsonBench.java +++ b/src/main/java/com/github/fabienrenaud/jjb/JsonBench.java @@ -130,4 +130,9 @@ public Object qson() throws Exception { public Object antons() throws Exception { return null; } + + public Object quickbuf_json() throws Exception { + return null; + } + } diff --git a/src/main/java/com/github/fabienrenaud/jjb/data/JsonSource.java b/src/main/java/com/github/fabienrenaud/jjb/data/JsonSource.java index add086c..ec7dbd3 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/data/JsonSource.java +++ b/src/main/java/com/github/fabienrenaud/jjb/data/JsonSource.java @@ -8,6 +8,7 @@ import okio.BufferedSource; import okio.ForwardingSource; import okio.Okio; +import us.hebi.quickbuf.ProtoMessage; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -21,6 +22,7 @@ public abstract class JsonSource { private final T[] jsonAsObject; private final String[] jsonAsString; private final byte[][] jsonAsBytes; + private final ProtoMessage[] jsonAsQuickbufObject; private final ThreadLocal jsonAsByteArrayInputStream; private final DataGenerator dataGenerator; @@ -33,6 +35,7 @@ public abstract class JsonSource { this.jsonAsObject = newPojoArray(quantity); this.jsonAsString = new String[quantity]; this.jsonAsBytes = new byte[quantity][]; + this.jsonAsQuickbufObject = new ProtoMessage[quantity]; this.dataGenerator = dataGenerator; this.streamSerializer = streamSerializer; @@ -58,6 +61,8 @@ private void populateFields(int quantity, int individualSize) { String json = provider.jackson().writeValueAsString(obj); jsonAsString[i] = json; jsonAsBytes[i] = json.getBytes(); + jsonAsQuickbufObject[i] = provider().quickbufPojo().clearQuick().clone().mergeFrom( + us.hebi.quickbuf.JsonSource.newInstance(jsonAsBytes[i]).setIgnoreUnknownFields(false)); } } catch (Exception ex) { ex.printStackTrace(); @@ -100,6 +105,10 @@ public T nextPojo() { return jsonAsObject[index(jsonAsObject.length)]; } + public ProtoMessage nextQuickbufPojo() { + return jsonAsQuickbufObject[index(jsonAsQuickbufObject.length)]; + } + public StreamSerializer streamSerializer() { return streamSerializer; } diff --git a/src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java b/src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java index a183d2e..78f0abc 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java +++ b/src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java @@ -136,4 +136,12 @@ public Object moshi() throws Exception { public Object qson() throws Exception { return JSON_SOURCE().provider().qson().read(JSON_SOURCE().nextByteArray(), JSON_SOURCE().pojoType()); } + + @Benchmark + @Override + public Object quickbuf_json() throws Exception { + return JSON_SOURCE().provider().quickbufPojo().clearQuick() + .mergeFrom(us.hebi.quickbuf.JsonSource.newInstance(JSON_SOURCE().nextByteArray())); + } + } diff --git a/src/main/java/com/github/fabienrenaud/jjb/databind/Serialization.java b/src/main/java/com/github/fabienrenaud/jjb/databind/Serialization.java index f20662a..f750014 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/databind/Serialization.java +++ b/src/main/java/com/github/fabienrenaud/jjb/databind/Serialization.java @@ -168,4 +168,11 @@ public Object qson() throws Exception { JSON_SOURCE().provider().qson().writeStream(JSON_SOURCE().nextPojo(), baos); return baos; } + + @Benchmark + @Override + public Object quickbuf_json() throws Exception { + return JSON_SOURCE().provider().quickbufSink().clear().writeMessage(JSON_SOURCE().nextQuickbufPojo()); + } + } diff --git a/src/main/java/com/github/fabienrenaud/jjb/model/quickbuf/QuickbufSchema.java b/src/main/java/com/github/fabienrenaud/jjb/model/quickbuf/QuickbufSchema.java new file mode 100644 index 0000000..f626107 --- /dev/null +++ b/src/main/java/com/github/fabienrenaud/jjb/model/quickbuf/QuickbufSchema.java @@ -0,0 +1,6292 @@ +// Code generated by protocol buffer compiler. Do not edit! +package com.github.fabienrenaud.jjb.model.quickbuf; + +import java.io.IOException; +import java.util.List; +import us.hebi.quickbuf.FieldName; +import us.hebi.quickbuf.InvalidProtocolBufferException; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.JsonSource; +import us.hebi.quickbuf.MessageFactory; +import us.hebi.quickbuf.ProtoEnum; +import us.hebi.quickbuf.ProtoMessage; +import us.hebi.quickbuf.ProtoSink; +import us.hebi.quickbuf.ProtoSource; +import us.hebi.quickbuf.ProtoUtil; +import us.hebi.quickbuf.RepeatedLong; +import us.hebi.quickbuf.RepeatedMessage; +import us.hebi.quickbuf.RepeatedString; +import us.hebi.quickbuf.UninitializedMessageException; +import us.hebi.quickbuf.Utf8String; + +public final class QuickbufSchema { + /** + * Protobuf type {@code Users} + */ + public static final class Users extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * repeated .quickbuf_unittest.Users.User users = 1; + */ + private final RepeatedMessage users = RepeatedMessage.newEmptyInstance(User.getFactory()); + + private Users() { + } + + /** + * @return a new empty instance of {@code Users} + */ + public static Users newInstance() { + return new Users(); + } + + /** + * repeated .quickbuf_unittest.Users.User users = 1; + * @return whether the users field is set + */ + public boolean hasUsers() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * repeated .quickbuf_unittest.Users.User users = 1; + * @return this + */ + public Users clearUsers() { + bitField0_ &= ~0x00000001; + users.clear(); + return this; + } + + /** + * repeated .quickbuf_unittest.Users.User users = 1; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableUsers()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getUsers() { + return users; + } + + /** + * repeated .quickbuf_unittest.Users.User users = 1; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedMessage getMutableUsers() { + bitField0_ |= 0x00000001; + return users; + } + + /** + * repeated .quickbuf_unittest.Users.User users = 1; + * @param value the users to add + * @return this + */ + public Users addUsers(final User value) { + bitField0_ |= 0x00000001; + users.add(value); + return this; + } + + /** + * repeated .quickbuf_unittest.Users.User users = 1; + * @param values the users to add + * @return this + */ + public Users addAllUsers(final User... values) { + bitField0_ |= 0x00000001; + users.addAll(values); + return this; + } + + @Override + public Users copyFrom(final Users other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + users.copyFrom(other.users); + } + return this; + } + + @Override + public Users mergeFrom(final Users other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasUsers()) { + getMutableUsers().addAll(other.users); + } + return this; + } + + @Override + public Users clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + users.clear(); + return this; + } + + @Override + public Users clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + users.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Users)) { + return false; + } + Users other = (Users) o; + return bitField0_ == other.bitField0_ + && (!hasUsers() || users.equals(other.users)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + try { + if ((bitField0_ & 0x00000001) != 0) { + for (int i = 0; i < users.length(); i++) { + output.writeRawByte((byte) 10); + output.writeMessageNoTag(users.get(i)); + } + } + } catch (UninitializedMessageException nestedFail) { + throw rethrowFromParent(nestedFail); + } + } + + @Override + protected int computeSerializedSize() { + try { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += (1 * users.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(users); + } + return size; + } catch (UninitializedMessageException nestedFail) { + throw rethrowFromParent(nestedFail); + } + } + + @Override + @SuppressWarnings("fallthrough") + public Users mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 10: { + // users + tag = input.readRepeatedMessage(users, tag); + bitField0_ |= 0x00000001; + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public final boolean isInitialized() { + if (hasUsers() && !users.isInitialized()) { + return false; + } + return true; + } + + @Override + protected final void getMissingFields(String prefix, List results) { + if (hasUsers() && !users.isInitialized()) { + getMissingFields(prefix, "users", users, results); + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + try { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeRepeatedMessage(FieldNames.users, users); + } + output.endObject(); + } catch (UninitializedMessageException nestedFail) { + throw rethrowFromParent(nestedFail); + } + } + + @Override + public Users mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 111578632: { + if (input.isAtField(FieldNames.users)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(users); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public Users clone() { + return new Users().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static Users parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new Users(), data).checkInitialized(); + } + + public static Users parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new Users(), input).checkInitialized(); + } + + public static Users parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new Users(), input).checkInitialized(); + } + + /** + * @return factory for creating Users messages + */ + public static MessageFactory getFactory() { + return UsersFactory.INSTANCE; + } + + /** + * Protobuf type {@code User} + */ + public static final class User extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional double latitude = 17; + */ + private double latitude; + + /** + * optional double longitude = 18; + */ + private double longitude; + + /** + * optional uint32 index = 2; + */ + private int index; + + /** + * optional uint32 age = 7; + */ + private int age; + + /** + * optional bool isActive = 4; + */ + private boolean isActive; + + /** + * optional string id = 1; + */ + private final Utf8String id = Utf8String.newEmptyInstance(); + + /** + * optional string guid = 3; + */ + private final Utf8String guid = Utf8String.newEmptyInstance(); + + /** + * optional string balance = 5; + */ + private final Utf8String balance = Utf8String.newEmptyInstance(); + + /** + * optional string picture = 6; + */ + private final Utf8String picture = Utf8String.newEmptyInstance(); + + /** + * optional string eyeColor = 8; + */ + private final Utf8String eyeColor = Utf8String.newEmptyInstance(); + + /** + * optional string name = 9; + */ + private final Utf8String name = Utf8String.newEmptyInstance(); + + /** + * optional string gender = 10; + */ + private final Utf8String gender = Utf8String.newEmptyInstance(); + + /** + * optional string company = 11; + */ + private final Utf8String company = Utf8String.newEmptyInstance(); + + /** + * optional string email = 12; + */ + private final Utf8String email = Utf8String.newEmptyInstance(); + + /** + * optional string phone = 13; + */ + private final Utf8String phone = Utf8String.newEmptyInstance(); + + /** + * optional string address = 14; + */ + private final Utf8String address = Utf8String.newEmptyInstance(); + + /** + * optional string about = 15; + */ + private final Utf8String about = Utf8String.newEmptyInstance(); + + /** + * optional string registered = 16; + */ + private final Utf8String registered = Utf8String.newEmptyInstance(); + + /** + * optional string greeting = 21; + */ + private final Utf8String greeting = Utf8String.newEmptyInstance(); + + /** + * optional string favoriteFruit = 22; + */ + private final Utf8String favoriteFruit = Utf8String.newEmptyInstance(); + + /** + * repeated .quickbuf_unittest.Users.Friend friends = 20; + */ + private final RepeatedMessage friends = RepeatedMessage.newEmptyInstance(Friend.getFactory()); + + /** + * repeated string tags = 19; + */ + private final RepeatedString tags = RepeatedString.newEmptyInstance(); + + private User() { + } + + /** + * @return a new empty instance of {@code User} + */ + public static User newInstance() { + return new User(); + } + + /** + * optional double latitude = 17; + * @return whether the latitude field is set + */ + public boolean hasLatitude() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional double latitude = 17; + * @return this + */ + public User clearLatitude() { + bitField0_ &= ~0x00000001; + latitude = 0D; + return this; + } + + /** + * optional double latitude = 17; + * @return the latitude + */ + public double getLatitude() { + return latitude; + } + + /** + * optional double latitude = 17; + * @param value the latitude to set + * @return this + */ + public User setLatitude(final double value) { + bitField0_ |= 0x00000001; + latitude = value; + return this; + } + + /** + * optional double longitude = 18; + * @return whether the longitude field is set + */ + public boolean hasLongitude() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional double longitude = 18; + * @return this + */ + public User clearLongitude() { + bitField0_ &= ~0x00000002; + longitude = 0D; + return this; + } + + /** + * optional double longitude = 18; + * @return the longitude + */ + public double getLongitude() { + return longitude; + } + + /** + * optional double longitude = 18; + * @param value the longitude to set + * @return this + */ + public User setLongitude(final double value) { + bitField0_ |= 0x00000002; + longitude = value; + return this; + } + + /** + * optional uint32 index = 2; + * @return whether the index field is set + */ + public boolean hasIndex() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional uint32 index = 2; + * @return this + */ + public User clearIndex() { + bitField0_ &= ~0x00000004; + index = 0; + return this; + } + + /** + * optional uint32 index = 2; + * @return the index + */ + public int getIndex() { + return index; + } + + /** + * optional uint32 index = 2; + * @param value the index to set + * @return this + */ + public User setIndex(final int value) { + bitField0_ |= 0x00000004; + index = value; + return this; + } + + /** + * optional uint32 age = 7; + * @return whether the age field is set + */ + public boolean hasAge() { + return (bitField0_ & 0x00000008) != 0; + } + + /** + * optional uint32 age = 7; + * @return this + */ + public User clearAge() { + bitField0_ &= ~0x00000008; + age = 0; + return this; + } + + /** + * optional uint32 age = 7; + * @return the age + */ + public int getAge() { + return age; + } + + /** + * optional uint32 age = 7; + * @param value the age to set + * @return this + */ + public User setAge(final int value) { + bitField0_ |= 0x00000008; + age = value; + return this; + } + + /** + * optional bool isActive = 4; + * @return whether the isActive field is set + */ + public boolean hasIsActive() { + return (bitField0_ & 0x00000010) != 0; + } + + /** + * optional bool isActive = 4; + * @return this + */ + public User clearIsActive() { + bitField0_ &= ~0x00000010; + isActive = false; + return this; + } + + /** + * optional bool isActive = 4; + * @return the isActive + */ + public boolean getIsActive() { + return isActive; + } + + /** + * optional bool isActive = 4; + * @param value the isActive to set + * @return this + */ + public User setIsActive(final boolean value) { + bitField0_ |= 0x00000010; + isActive = value; + return this; + } + + /** + * optional string id = 1; + * @return whether the id field is set + */ + public boolean hasId() { + return (bitField0_ & 0x00000020) != 0; + } + + /** + * optional string id = 1; + * @return this + */ + public User clearId() { + bitField0_ &= ~0x00000020; + id.clear(); + return this; + } + + /** + * optional string id = 1; + * @return the id + */ + public String getId() { + return id.getString(); + } + + /** + * optional string id = 1; + * @return internal {@code Utf8String} representation of id for reading + */ + public Utf8String getIdBytes() { + return this.id; + } + + /** + * optional string id = 1; + * @return internal {@code Utf8String} representation of id for modifications + */ + public Utf8String getMutableIdBytes() { + bitField0_ |= 0x00000020; + return this.id; + } + + /** + * optional string id = 1; + * @param value the id to set + * @return this + */ + public User setId(final CharSequence value) { + bitField0_ |= 0x00000020; + id.copyFrom(value); + return this; + } + + /** + * optional string id = 1; + * @param value the id to set + * @return this + */ + public User setId(final Utf8String value) { + bitField0_ |= 0x00000020; + id.copyFrom(value); + return this; + } + + /** + * optional string guid = 3; + * @return whether the guid field is set + */ + public boolean hasGuid() { + return (bitField0_ & 0x00000040) != 0; + } + + /** + * optional string guid = 3; + * @return this + */ + public User clearGuid() { + bitField0_ &= ~0x00000040; + guid.clear(); + return this; + } + + /** + * optional string guid = 3; + * @return the guid + */ + public String getGuid() { + return guid.getString(); + } + + /** + * optional string guid = 3; + * @return internal {@code Utf8String} representation of guid for reading + */ + public Utf8String getGuidBytes() { + return this.guid; + } + + /** + * optional string guid = 3; + * @return internal {@code Utf8String} representation of guid for modifications + */ + public Utf8String getMutableGuidBytes() { + bitField0_ |= 0x00000040; + return this.guid; + } + + /** + * optional string guid = 3; + * @param value the guid to set + * @return this + */ + public User setGuid(final CharSequence value) { + bitField0_ |= 0x00000040; + guid.copyFrom(value); + return this; + } + + /** + * optional string guid = 3; + * @param value the guid to set + * @return this + */ + public User setGuid(final Utf8String value) { + bitField0_ |= 0x00000040; + guid.copyFrom(value); + return this; + } + + /** + * optional string balance = 5; + * @return whether the balance field is set + */ + public boolean hasBalance() { + return (bitField0_ & 0x00000080) != 0; + } + + /** + * optional string balance = 5; + * @return this + */ + public User clearBalance() { + bitField0_ &= ~0x00000080; + balance.clear(); + return this; + } + + /** + * optional string balance = 5; + * @return the balance + */ + public String getBalance() { + return balance.getString(); + } + + /** + * optional string balance = 5; + * @return internal {@code Utf8String} representation of balance for reading + */ + public Utf8String getBalanceBytes() { + return this.balance; + } + + /** + * optional string balance = 5; + * @return internal {@code Utf8String} representation of balance for modifications + */ + public Utf8String getMutableBalanceBytes() { + bitField0_ |= 0x00000080; + return this.balance; + } + + /** + * optional string balance = 5; + * @param value the balance to set + * @return this + */ + public User setBalance(final CharSequence value) { + bitField0_ |= 0x00000080; + balance.copyFrom(value); + return this; + } + + /** + * optional string balance = 5; + * @param value the balance to set + * @return this + */ + public User setBalance(final Utf8String value) { + bitField0_ |= 0x00000080; + balance.copyFrom(value); + return this; + } + + /** + * optional string picture = 6; + * @return whether the picture field is set + */ + public boolean hasPicture() { + return (bitField0_ & 0x00000100) != 0; + } + + /** + * optional string picture = 6; + * @return this + */ + public User clearPicture() { + bitField0_ &= ~0x00000100; + picture.clear(); + return this; + } + + /** + * optional string picture = 6; + * @return the picture + */ + public String getPicture() { + return picture.getString(); + } + + /** + * optional string picture = 6; + * @return internal {@code Utf8String} representation of picture for reading + */ + public Utf8String getPictureBytes() { + return this.picture; + } + + /** + * optional string picture = 6; + * @return internal {@code Utf8String} representation of picture for modifications + */ + public Utf8String getMutablePictureBytes() { + bitField0_ |= 0x00000100; + return this.picture; + } + + /** + * optional string picture = 6; + * @param value the picture to set + * @return this + */ + public User setPicture(final CharSequence value) { + bitField0_ |= 0x00000100; + picture.copyFrom(value); + return this; + } + + /** + * optional string picture = 6; + * @param value the picture to set + * @return this + */ + public User setPicture(final Utf8String value) { + bitField0_ |= 0x00000100; + picture.copyFrom(value); + return this; + } + + /** + * optional string eyeColor = 8; + * @return whether the eyeColor field is set + */ + public boolean hasEyeColor() { + return (bitField0_ & 0x00000200) != 0; + } + + /** + * optional string eyeColor = 8; + * @return this + */ + public User clearEyeColor() { + bitField0_ &= ~0x00000200; + eyeColor.clear(); + return this; + } + + /** + * optional string eyeColor = 8; + * @return the eyeColor + */ + public String getEyeColor() { + return eyeColor.getString(); + } + + /** + * optional string eyeColor = 8; + * @return internal {@code Utf8String} representation of eyeColor for reading + */ + public Utf8String getEyeColorBytes() { + return this.eyeColor; + } + + /** + * optional string eyeColor = 8; + * @return internal {@code Utf8String} representation of eyeColor for modifications + */ + public Utf8String getMutableEyeColorBytes() { + bitField0_ |= 0x00000200; + return this.eyeColor; + } + + /** + * optional string eyeColor = 8; + * @param value the eyeColor to set + * @return this + */ + public User setEyeColor(final CharSequence value) { + bitField0_ |= 0x00000200; + eyeColor.copyFrom(value); + return this; + } + + /** + * optional string eyeColor = 8; + * @param value the eyeColor to set + * @return this + */ + public User setEyeColor(final Utf8String value) { + bitField0_ |= 0x00000200; + eyeColor.copyFrom(value); + return this; + } + + /** + * optional string name = 9; + * @return whether the name field is set + */ + public boolean hasName() { + return (bitField0_ & 0x00000400) != 0; + } + + /** + * optional string name = 9; + * @return this + */ + public User clearName() { + bitField0_ &= ~0x00000400; + name.clear(); + return this; + } + + /** + * optional string name = 9; + * @return the name + */ + public String getName() { + return name.getString(); + } + + /** + * optional string name = 9; + * @return internal {@code Utf8String} representation of name for reading + */ + public Utf8String getNameBytes() { + return this.name; + } + + /** + * optional string name = 9; + * @return internal {@code Utf8String} representation of name for modifications + */ + public Utf8String getMutableNameBytes() { + bitField0_ |= 0x00000400; + return this.name; + } + + /** + * optional string name = 9; + * @param value the name to set + * @return this + */ + public User setName(final CharSequence value) { + bitField0_ |= 0x00000400; + name.copyFrom(value); + return this; + } + + /** + * optional string name = 9; + * @param value the name to set + * @return this + */ + public User setName(final Utf8String value) { + bitField0_ |= 0x00000400; + name.copyFrom(value); + return this; + } + + /** + * optional string gender = 10; + * @return whether the gender field is set + */ + public boolean hasGender() { + return (bitField0_ & 0x00000800) != 0; + } + + /** + * optional string gender = 10; + * @return this + */ + public User clearGender() { + bitField0_ &= ~0x00000800; + gender.clear(); + return this; + } + + /** + * optional string gender = 10; + * @return the gender + */ + public String getGender() { + return gender.getString(); + } + + /** + * optional string gender = 10; + * @return internal {@code Utf8String} representation of gender for reading + */ + public Utf8String getGenderBytes() { + return this.gender; + } + + /** + * optional string gender = 10; + * @return internal {@code Utf8String} representation of gender for modifications + */ + public Utf8String getMutableGenderBytes() { + bitField0_ |= 0x00000800; + return this.gender; + } + + /** + * optional string gender = 10; + * @param value the gender to set + * @return this + */ + public User setGender(final CharSequence value) { + bitField0_ |= 0x00000800; + gender.copyFrom(value); + return this; + } + + /** + * optional string gender = 10; + * @param value the gender to set + * @return this + */ + public User setGender(final Utf8String value) { + bitField0_ |= 0x00000800; + gender.copyFrom(value); + return this; + } + + /** + * optional string company = 11; + * @return whether the company field is set + */ + public boolean hasCompany() { + return (bitField0_ & 0x00001000) != 0; + } + + /** + * optional string company = 11; + * @return this + */ + public User clearCompany() { + bitField0_ &= ~0x00001000; + company.clear(); + return this; + } + + /** + * optional string company = 11; + * @return the company + */ + public String getCompany() { + return company.getString(); + } + + /** + * optional string company = 11; + * @return internal {@code Utf8String} representation of company for reading + */ + public Utf8String getCompanyBytes() { + return this.company; + } + + /** + * optional string company = 11; + * @return internal {@code Utf8String} representation of company for modifications + */ + public Utf8String getMutableCompanyBytes() { + bitField0_ |= 0x00001000; + return this.company; + } + + /** + * optional string company = 11; + * @param value the company to set + * @return this + */ + public User setCompany(final CharSequence value) { + bitField0_ |= 0x00001000; + company.copyFrom(value); + return this; + } + + /** + * optional string company = 11; + * @param value the company to set + * @return this + */ + public User setCompany(final Utf8String value) { + bitField0_ |= 0x00001000; + company.copyFrom(value); + return this; + } + + /** + * optional string email = 12; + * @return whether the email field is set + */ + public boolean hasEmail() { + return (bitField0_ & 0x00002000) != 0; + } + + /** + * optional string email = 12; + * @return this + */ + public User clearEmail() { + bitField0_ &= ~0x00002000; + email.clear(); + return this; + } + + /** + * optional string email = 12; + * @return the email + */ + public String getEmail() { + return email.getString(); + } + + /** + * optional string email = 12; + * @return internal {@code Utf8String} representation of email for reading + */ + public Utf8String getEmailBytes() { + return this.email; + } + + /** + * optional string email = 12; + * @return internal {@code Utf8String} representation of email for modifications + */ + public Utf8String getMutableEmailBytes() { + bitField0_ |= 0x00002000; + return this.email; + } + + /** + * optional string email = 12; + * @param value the email to set + * @return this + */ + public User setEmail(final CharSequence value) { + bitField0_ |= 0x00002000; + email.copyFrom(value); + return this; + } + + /** + * optional string email = 12; + * @param value the email to set + * @return this + */ + public User setEmail(final Utf8String value) { + bitField0_ |= 0x00002000; + email.copyFrom(value); + return this; + } + + /** + * optional string phone = 13; + * @return whether the phone field is set + */ + public boolean hasPhone() { + return (bitField0_ & 0x00004000) != 0; + } + + /** + * optional string phone = 13; + * @return this + */ + public User clearPhone() { + bitField0_ &= ~0x00004000; + phone.clear(); + return this; + } + + /** + * optional string phone = 13; + * @return the phone + */ + public String getPhone() { + return phone.getString(); + } + + /** + * optional string phone = 13; + * @return internal {@code Utf8String} representation of phone for reading + */ + public Utf8String getPhoneBytes() { + return this.phone; + } + + /** + * optional string phone = 13; + * @return internal {@code Utf8String} representation of phone for modifications + */ + public Utf8String getMutablePhoneBytes() { + bitField0_ |= 0x00004000; + return this.phone; + } + + /** + * optional string phone = 13; + * @param value the phone to set + * @return this + */ + public User setPhone(final CharSequence value) { + bitField0_ |= 0x00004000; + phone.copyFrom(value); + return this; + } + + /** + * optional string phone = 13; + * @param value the phone to set + * @return this + */ + public User setPhone(final Utf8String value) { + bitField0_ |= 0x00004000; + phone.copyFrom(value); + return this; + } + + /** + * optional string address = 14; + * @return whether the address field is set + */ + public boolean hasAddress() { + return (bitField0_ & 0x00008000) != 0; + } + + /** + * optional string address = 14; + * @return this + */ + public User clearAddress() { + bitField0_ &= ~0x00008000; + address.clear(); + return this; + } + + /** + * optional string address = 14; + * @return the address + */ + public String getAddress() { + return address.getString(); + } + + /** + * optional string address = 14; + * @return internal {@code Utf8String} representation of address for reading + */ + public Utf8String getAddressBytes() { + return this.address; + } + + /** + * optional string address = 14; + * @return internal {@code Utf8String} representation of address for modifications + */ + public Utf8String getMutableAddressBytes() { + bitField0_ |= 0x00008000; + return this.address; + } + + /** + * optional string address = 14; + * @param value the address to set + * @return this + */ + public User setAddress(final CharSequence value) { + bitField0_ |= 0x00008000; + address.copyFrom(value); + return this; + } + + /** + * optional string address = 14; + * @param value the address to set + * @return this + */ + public User setAddress(final Utf8String value) { + bitField0_ |= 0x00008000; + address.copyFrom(value); + return this; + } + + /** + * optional string about = 15; + * @return whether the about field is set + */ + public boolean hasAbout() { + return (bitField0_ & 0x00010000) != 0; + } + + /** + * optional string about = 15; + * @return this + */ + public User clearAbout() { + bitField0_ &= ~0x00010000; + about.clear(); + return this; + } + + /** + * optional string about = 15; + * @return the about + */ + public String getAbout() { + return about.getString(); + } + + /** + * optional string about = 15; + * @return internal {@code Utf8String} representation of about for reading + */ + public Utf8String getAboutBytes() { + return this.about; + } + + /** + * optional string about = 15; + * @return internal {@code Utf8String} representation of about for modifications + */ + public Utf8String getMutableAboutBytes() { + bitField0_ |= 0x00010000; + return this.about; + } + + /** + * optional string about = 15; + * @param value the about to set + * @return this + */ + public User setAbout(final CharSequence value) { + bitField0_ |= 0x00010000; + about.copyFrom(value); + return this; + } + + /** + * optional string about = 15; + * @param value the about to set + * @return this + */ + public User setAbout(final Utf8String value) { + bitField0_ |= 0x00010000; + about.copyFrom(value); + return this; + } + + /** + * optional string registered = 16; + * @return whether the registered field is set + */ + public boolean hasRegistered() { + return (bitField0_ & 0x00020000) != 0; + } + + /** + * optional string registered = 16; + * @return this + */ + public User clearRegistered() { + bitField0_ &= ~0x00020000; + registered.clear(); + return this; + } + + /** + * optional string registered = 16; + * @return the registered + */ + public String getRegistered() { + return registered.getString(); + } + + /** + * optional string registered = 16; + * @return internal {@code Utf8String} representation of registered for reading + */ + public Utf8String getRegisteredBytes() { + return this.registered; + } + + /** + * optional string registered = 16; + * @return internal {@code Utf8String} representation of registered for modifications + */ + public Utf8String getMutableRegisteredBytes() { + bitField0_ |= 0x00020000; + return this.registered; + } + + /** + * optional string registered = 16; + * @param value the registered to set + * @return this + */ + public User setRegistered(final CharSequence value) { + bitField0_ |= 0x00020000; + registered.copyFrom(value); + return this; + } + + /** + * optional string registered = 16; + * @param value the registered to set + * @return this + */ + public User setRegistered(final Utf8String value) { + bitField0_ |= 0x00020000; + registered.copyFrom(value); + return this; + } + + /** + * optional string greeting = 21; + * @return whether the greeting field is set + */ + public boolean hasGreeting() { + return (bitField0_ & 0x00040000) != 0; + } + + /** + * optional string greeting = 21; + * @return this + */ + public User clearGreeting() { + bitField0_ &= ~0x00040000; + greeting.clear(); + return this; + } + + /** + * optional string greeting = 21; + * @return the greeting + */ + public String getGreeting() { + return greeting.getString(); + } + + /** + * optional string greeting = 21; + * @return internal {@code Utf8String} representation of greeting for reading + */ + public Utf8String getGreetingBytes() { + return this.greeting; + } + + /** + * optional string greeting = 21; + * @return internal {@code Utf8String} representation of greeting for modifications + */ + public Utf8String getMutableGreetingBytes() { + bitField0_ |= 0x00040000; + return this.greeting; + } + + /** + * optional string greeting = 21; + * @param value the greeting to set + * @return this + */ + public User setGreeting(final CharSequence value) { + bitField0_ |= 0x00040000; + greeting.copyFrom(value); + return this; + } + + /** + * optional string greeting = 21; + * @param value the greeting to set + * @return this + */ + public User setGreeting(final Utf8String value) { + bitField0_ |= 0x00040000; + greeting.copyFrom(value); + return this; + } + + /** + * optional string favoriteFruit = 22; + * @return whether the favoriteFruit field is set + */ + public boolean hasFavoriteFruit() { + return (bitField0_ & 0x00080000) != 0; + } + + /** + * optional string favoriteFruit = 22; + * @return this + */ + public User clearFavoriteFruit() { + bitField0_ &= ~0x00080000; + favoriteFruit.clear(); + return this; + } + + /** + * optional string favoriteFruit = 22; + * @return the favoriteFruit + */ + public String getFavoriteFruit() { + return favoriteFruit.getString(); + } + + /** + * optional string favoriteFruit = 22; + * @return internal {@code Utf8String} representation of favoriteFruit for reading + */ + public Utf8String getFavoriteFruitBytes() { + return this.favoriteFruit; + } + + /** + * optional string favoriteFruit = 22; + * @return internal {@code Utf8String} representation of favoriteFruit for modifications + */ + public Utf8String getMutableFavoriteFruitBytes() { + bitField0_ |= 0x00080000; + return this.favoriteFruit; + } + + /** + * optional string favoriteFruit = 22; + * @param value the favoriteFruit to set + * @return this + */ + public User setFavoriteFruit(final CharSequence value) { + bitField0_ |= 0x00080000; + favoriteFruit.copyFrom(value); + return this; + } + + /** + * optional string favoriteFruit = 22; + * @param value the favoriteFruit to set + * @return this + */ + public User setFavoriteFruit(final Utf8String value) { + bitField0_ |= 0x00080000; + favoriteFruit.copyFrom(value); + return this; + } + + /** + * repeated .quickbuf_unittest.Users.Friend friends = 20; + * @return whether the friends field is set + */ + public boolean hasFriends() { + return (bitField0_ & 0x00100000) != 0; + } + + /** + * repeated .quickbuf_unittest.Users.Friend friends = 20; + * @return this + */ + public User clearFriends() { + bitField0_ &= ~0x00100000; + friends.clear(); + return this; + } + + /** + * repeated .quickbuf_unittest.Users.Friend friends = 20; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableFriends()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getFriends() { + return friends; + } + + /** + * repeated .quickbuf_unittest.Users.Friend friends = 20; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedMessage getMutableFriends() { + bitField0_ |= 0x00100000; + return friends; + } + + /** + * repeated .quickbuf_unittest.Users.Friend friends = 20; + * @param value the friends to add + * @return this + */ + public User addFriends(final Friend value) { + bitField0_ |= 0x00100000; + friends.add(value); + return this; + } + + /** + * repeated .quickbuf_unittest.Users.Friend friends = 20; + * @param values the friends to add + * @return this + */ + public User addAllFriends(final Friend... values) { + bitField0_ |= 0x00100000; + friends.addAll(values); + return this; + } + + /** + * repeated string tags = 19; + * @return whether the tags field is set + */ + public boolean hasTags() { + return (bitField0_ & 0x00200000) != 0; + } + + /** + * repeated string tags = 19; + * @return this + */ + public User clearTags() { + bitField0_ &= ~0x00200000; + tags.clear(); + return this; + } + + /** + * repeated string tags = 19; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableTags()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedString getTags() { + return tags; + } + + /** + * repeated string tags = 19; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedString getMutableTags() { + bitField0_ |= 0x00200000; + return tags; + } + + /** + * repeated string tags = 19; + * @param value the tags to add + * @return this + */ + public User addTags(final CharSequence value) { + bitField0_ |= 0x00200000; + tags.add(value); + return this; + } + + /** + * repeated string tags = 19; + * @param values the tags to add + * @return this + */ + public User addAllTags(final CharSequence... values) { + bitField0_ |= 0x00200000; + tags.addAll(values); + return this; + } + + @Override + public User copyFrom(final User other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + latitude = other.latitude; + longitude = other.longitude; + index = other.index; + age = other.age; + isActive = other.isActive; + id.copyFrom(other.id); + guid.copyFrom(other.guid); + balance.copyFrom(other.balance); + picture.copyFrom(other.picture); + eyeColor.copyFrom(other.eyeColor); + name.copyFrom(other.name); + gender.copyFrom(other.gender); + company.copyFrom(other.company); + email.copyFrom(other.email); + phone.copyFrom(other.phone); + address.copyFrom(other.address); + about.copyFrom(other.about); + registered.copyFrom(other.registered); + greeting.copyFrom(other.greeting); + favoriteFruit.copyFrom(other.favoriteFruit); + friends.copyFrom(other.friends); + tags.copyFrom(other.tags); + } + return this; + } + + @Override + public User mergeFrom(final User other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasLatitude()) { + setLatitude(other.latitude); + } + if (other.hasLongitude()) { + setLongitude(other.longitude); + } + if (other.hasIndex()) { + setIndex(other.index); + } + if (other.hasAge()) { + setAge(other.age); + } + if (other.hasIsActive()) { + setIsActive(other.isActive); + } + if (other.hasId()) { + getMutableIdBytes().copyFrom(other.id); + } + if (other.hasGuid()) { + getMutableGuidBytes().copyFrom(other.guid); + } + if (other.hasBalance()) { + getMutableBalanceBytes().copyFrom(other.balance); + } + if (other.hasPicture()) { + getMutablePictureBytes().copyFrom(other.picture); + } + if (other.hasEyeColor()) { + getMutableEyeColorBytes().copyFrom(other.eyeColor); + } + if (other.hasName()) { + getMutableNameBytes().copyFrom(other.name); + } + if (other.hasGender()) { + getMutableGenderBytes().copyFrom(other.gender); + } + if (other.hasCompany()) { + getMutableCompanyBytes().copyFrom(other.company); + } + if (other.hasEmail()) { + getMutableEmailBytes().copyFrom(other.email); + } + if (other.hasPhone()) { + getMutablePhoneBytes().copyFrom(other.phone); + } + if (other.hasAddress()) { + getMutableAddressBytes().copyFrom(other.address); + } + if (other.hasAbout()) { + getMutableAboutBytes().copyFrom(other.about); + } + if (other.hasRegistered()) { + getMutableRegisteredBytes().copyFrom(other.registered); + } + if (other.hasGreeting()) { + getMutableGreetingBytes().copyFrom(other.greeting); + } + if (other.hasFavoriteFruit()) { + getMutableFavoriteFruitBytes().copyFrom(other.favoriteFruit); + } + if (other.hasFriends()) { + getMutableFriends().addAll(other.friends); + } + if (other.hasTags()) { + getMutableTags().addAll(other.tags); + } + return this; + } + + @Override + public User clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + latitude = 0D; + longitude = 0D; + index = 0; + age = 0; + isActive = false; + id.clear(); + guid.clear(); + balance.clear(); + picture.clear(); + eyeColor.clear(); + name.clear(); + gender.clear(); + company.clear(); + email.clear(); + phone.clear(); + address.clear(); + about.clear(); + registered.clear(); + greeting.clear(); + favoriteFruit.clear(); + friends.clear(); + tags.clear(); + return this; + } + + @Override + public User clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + id.clear(); + guid.clear(); + balance.clear(); + picture.clear(); + eyeColor.clear(); + name.clear(); + gender.clear(); + company.clear(); + email.clear(); + phone.clear(); + address.clear(); + about.clear(); + registered.clear(); + greeting.clear(); + favoriteFruit.clear(); + friends.clearQuick(); + tags.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof User)) { + return false; + } + User other = (User) o; + return bitField0_ == other.bitField0_ + && (!hasLatitude() || ProtoUtil.isEqual(latitude, other.latitude)) + && (!hasLongitude() || ProtoUtil.isEqual(longitude, other.longitude)) + && (!hasIndex() || index == other.index) + && (!hasAge() || age == other.age) + && (!hasIsActive() || isActive == other.isActive) + && (!hasId() || id.equals(other.id)) + && (!hasGuid() || guid.equals(other.guid)) + && (!hasBalance() || balance.equals(other.balance)) + && (!hasPicture() || picture.equals(other.picture)) + && (!hasEyeColor() || eyeColor.equals(other.eyeColor)) + && (!hasName() || name.equals(other.name)) + && (!hasGender() || gender.equals(other.gender)) + && (!hasCompany() || company.equals(other.company)) + && (!hasEmail() || email.equals(other.email)) + && (!hasPhone() || phone.equals(other.phone)) + && (!hasAddress() || address.equals(other.address)) + && (!hasAbout() || about.equals(other.about)) + && (!hasRegistered() || registered.equals(other.registered)) + && (!hasGreeting() || greeting.equals(other.greeting)) + && (!hasFavoriteFruit() || favoriteFruit.equals(other.favoriteFruit)) + && (!hasFriends() || friends.equals(other.friends)) + && (!hasTags() || tags.equals(other.tags)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + try { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawLittleEndian16((short) 393); + output.writeDoubleNoTag(latitude); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawLittleEndian16((short) 401); + output.writeDoubleNoTag(longitude); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 16); + output.writeUInt32NoTag(index); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeRawByte((byte) 56); + output.writeUInt32NoTag(age); + } + if ((bitField0_ & 0x00000010) != 0) { + output.writeRawByte((byte) 32); + output.writeBoolNoTag(isActive); + } + if ((bitField0_ & 0x00000020) != 0) { + output.writeRawByte((byte) 10); + output.writeStringNoTag(id); + } + if ((bitField0_ & 0x00000040) != 0) { + output.writeRawByte((byte) 26); + output.writeStringNoTag(guid); + } + if ((bitField0_ & 0x00000080) != 0) { + output.writeRawByte((byte) 42); + output.writeStringNoTag(balance); + } + if ((bitField0_ & 0x00000100) != 0) { + output.writeRawByte((byte) 50); + output.writeStringNoTag(picture); + } + if ((bitField0_ & 0x00000200) != 0) { + output.writeRawByte((byte) 66); + output.writeStringNoTag(eyeColor); + } + if ((bitField0_ & 0x00000400) != 0) { + output.writeRawByte((byte) 74); + output.writeStringNoTag(name); + } + if ((bitField0_ & 0x00000800) != 0) { + output.writeRawByte((byte) 82); + output.writeStringNoTag(gender); + } + if ((bitField0_ & 0x00001000) != 0) { + output.writeRawByte((byte) 90); + output.writeStringNoTag(company); + } + if ((bitField0_ & 0x00002000) != 0) { + output.writeRawByte((byte) 98); + output.writeStringNoTag(email); + } + if ((bitField0_ & 0x00004000) != 0) { + output.writeRawByte((byte) 106); + output.writeStringNoTag(phone); + } + if ((bitField0_ & 0x00008000) != 0) { + output.writeRawByte((byte) 114); + output.writeStringNoTag(address); + } + if ((bitField0_ & 0x00010000) != 0) { + output.writeRawByte((byte) 122); + output.writeStringNoTag(about); + } + if ((bitField0_ & 0x00020000) != 0) { + output.writeRawLittleEndian16((short) 386); + output.writeStringNoTag(registered); + } + if ((bitField0_ & 0x00040000) != 0) { + output.writeRawLittleEndian16((short) 426); + output.writeStringNoTag(greeting); + } + if ((bitField0_ & 0x00080000) != 0) { + output.writeRawLittleEndian16((short) 434); + output.writeStringNoTag(favoriteFruit); + } + if ((bitField0_ & 0x00100000) != 0) { + for (int i = 0; i < friends.length(); i++) { + output.writeRawLittleEndian16((short) 418); + output.writeMessageNoTag(friends.get(i)); + } + } + if ((bitField0_ & 0x00200000) != 0) { + for (int i = 0; i < tags.length(); i++) { + output.writeRawLittleEndian16((short) 410); + output.writeStringNoTag(tags.get(i)); + } + } + } catch (UninitializedMessageException nestedFail) { + throw rethrowFromParent(nestedFail); + } + } + + @Override + protected int computeSerializedSize() { + try { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 10; + } + if ((bitField0_ & 0x00000002) != 0) { + size += 10; + } + if ((bitField0_ & 0x00000004) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(index); + } + if ((bitField0_ & 0x00000008) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(age); + } + if ((bitField0_ & 0x00000010) != 0) { + size += 2; + } + if ((bitField0_ & 0x00000020) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(id); + } + if ((bitField0_ & 0x00000040) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(guid); + } + if ((bitField0_ & 0x00000080) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(balance); + } + if ((bitField0_ & 0x00000100) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(picture); + } + if ((bitField0_ & 0x00000200) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(eyeColor); + } + if ((bitField0_ & 0x00000400) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(name); + } + if ((bitField0_ & 0x00000800) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(gender); + } + if ((bitField0_ & 0x00001000) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(company); + } + if ((bitField0_ & 0x00002000) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(email); + } + if ((bitField0_ & 0x00004000) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(phone); + } + if ((bitField0_ & 0x00008000) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(address); + } + if ((bitField0_ & 0x00010000) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(about); + } + if ((bitField0_ & 0x00020000) != 0) { + size += 2 + ProtoSink.computeStringSizeNoTag(registered); + } + if ((bitField0_ & 0x00040000) != 0) { + size += 2 + ProtoSink.computeStringSizeNoTag(greeting); + } + if ((bitField0_ & 0x00080000) != 0) { + size += 2 + ProtoSink.computeStringSizeNoTag(favoriteFruit); + } + if ((bitField0_ & 0x00100000) != 0) { + size += (2 * friends.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(friends); + } + if ((bitField0_ & 0x00200000) != 0) { + size += (2 * tags.length()) + ProtoSink.computeRepeatedStringSizeNoTag(tags); + } + return size; + } catch (UninitializedMessageException nestedFail) { + throw rethrowFromParent(nestedFail); + } + } + + @Override + @SuppressWarnings("fallthrough") + public User mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 137: { + // latitude + latitude = input.readDouble(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 145) { + break; + } + } + case 145: { + // longitude + longitude = input.readDouble(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 16) { + break; + } + } + case 16: { + // index + index = input.readUInt32(); + bitField0_ |= 0x00000004; + tag = input.readTag(); + if (tag != 56) { + break; + } + } + case 56: { + // age + age = input.readUInt32(); + bitField0_ |= 0x00000008; + tag = input.readTag(); + if (tag != 32) { + break; + } + } + case 32: { + // isActive + isActive = input.readBool(); + bitField0_ |= 0x00000010; + tag = input.readTag(); + if (tag != 10) { + break; + } + } + case 10: { + // id + input.readString(id); + bitField0_ |= 0x00000020; + tag = input.readTag(); + if (tag != 26) { + break; + } + } + case 26: { + // guid + input.readString(guid); + bitField0_ |= 0x00000040; + tag = input.readTag(); + if (tag != 42) { + break; + } + } + case 42: { + // balance + input.readString(balance); + bitField0_ |= 0x00000080; + tag = input.readTag(); + if (tag != 50) { + break; + } + } + case 50: { + // picture + input.readString(picture); + bitField0_ |= 0x00000100; + tag = input.readTag(); + if (tag != 66) { + break; + } + } + case 66: { + // eyeColor + input.readString(eyeColor); + bitField0_ |= 0x00000200; + tag = input.readTag(); + if (tag != 74) { + break; + } + } + case 74: { + // name + input.readString(name); + bitField0_ |= 0x00000400; + tag = input.readTag(); + if (tag != 82) { + break; + } + } + case 82: { + // gender + input.readString(gender); + bitField0_ |= 0x00000800; + tag = input.readTag(); + if (tag != 90) { + break; + } + } + case 90: { + // company + input.readString(company); + bitField0_ |= 0x00001000; + tag = input.readTag(); + if (tag != 98) { + break; + } + } + case 98: { + // email + input.readString(email); + bitField0_ |= 0x00002000; + tag = input.readTag(); + if (tag != 106) { + break; + } + } + case 106: { + // phone + input.readString(phone); + bitField0_ |= 0x00004000; + tag = input.readTag(); + if (tag != 114) { + break; + } + } + case 114: { + // address + input.readString(address); + bitField0_ |= 0x00008000; + tag = input.readTag(); + if (tag != 122) { + break; + } + } + case 122: { + // about + input.readString(about); + bitField0_ |= 0x00010000; + tag = input.readTag(); + if (tag != 130) { + break; + } + } + case 130: { + // registered + input.readString(registered); + bitField0_ |= 0x00020000; + tag = input.readTag(); + if (tag != 170) { + break; + } + } + case 170: { + // greeting + input.readString(greeting); + bitField0_ |= 0x00040000; + tag = input.readTag(); + if (tag != 178) { + break; + } + } + case 178: { + // favoriteFruit + input.readString(favoriteFruit); + bitField0_ |= 0x00080000; + tag = input.readTag(); + if (tag != 162) { + break; + } + } + case 162: { + // friends + tag = input.readRepeatedMessage(friends, tag); + bitField0_ |= 0x00100000; + if (tag != 154) { + break; + } + } + case 154: { + // tags + tag = input.readRepeatedString(tags, tag); + bitField0_ |= 0x00200000; + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public final boolean isInitialized() { + if (hasFriends() && !friends.isInitialized()) { + return false; + } + return true; + } + + @Override + protected final void getMissingFields(String prefix, List results) { + if (hasFriends() && !friends.isInitialized()) { + getMissingFields(prefix, "friends", friends, results); + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + try { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeDouble(FieldNames.latitude, latitude); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeDouble(FieldNames.longitude, longitude); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeUInt32(FieldNames.index, index); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeUInt32(FieldNames.age, age); + } + if ((bitField0_ & 0x00000010) != 0) { + output.writeBool(FieldNames.isActive, isActive); + } + if ((bitField0_ & 0x00000020) != 0) { + output.writeString(FieldNames.id, id); + } + if ((bitField0_ & 0x00000040) != 0) { + output.writeString(FieldNames.guid, guid); + } + if ((bitField0_ & 0x00000080) != 0) { + output.writeString(FieldNames.balance, balance); + } + if ((bitField0_ & 0x00000100) != 0) { + output.writeString(FieldNames.picture, picture); + } + if ((bitField0_ & 0x00000200) != 0) { + output.writeString(FieldNames.eyeColor, eyeColor); + } + if ((bitField0_ & 0x00000400) != 0) { + output.writeString(FieldNames.name, name); + } + if ((bitField0_ & 0x00000800) != 0) { + output.writeString(FieldNames.gender, gender); + } + if ((bitField0_ & 0x00001000) != 0) { + output.writeString(FieldNames.company, company); + } + if ((bitField0_ & 0x00002000) != 0) { + output.writeString(FieldNames.email, email); + } + if ((bitField0_ & 0x00004000) != 0) { + output.writeString(FieldNames.phone, phone); + } + if ((bitField0_ & 0x00008000) != 0) { + output.writeString(FieldNames.address, address); + } + if ((bitField0_ & 0x00010000) != 0) { + output.writeString(FieldNames.about, about); + } + if ((bitField0_ & 0x00020000) != 0) { + output.writeString(FieldNames.registered, registered); + } + if ((bitField0_ & 0x00040000) != 0) { + output.writeString(FieldNames.greeting, greeting); + } + if ((bitField0_ & 0x00080000) != 0) { + output.writeString(FieldNames.favoriteFruit, favoriteFruit); + } + if ((bitField0_ & 0x00100000) != 0) { + output.writeRepeatedMessage(FieldNames.friends, friends); + } + if ((bitField0_ & 0x00200000) != 0) { + output.writeRepeatedString(FieldNames.tags, tags); + } + output.endObject(); + } catch (UninitializedMessageException nestedFail) { + throw rethrowFromParent(nestedFail); + } + } + + @Override + public User mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -1439978388: { + if (input.isAtField(FieldNames.latitude)) { + if (!input.trySkipNullValue()) { + latitude = input.readDouble(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 137365935: { + if (input.isAtField(FieldNames.longitude)) { + if (!input.trySkipNullValue()) { + longitude = input.readDouble(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + case 100346066: { + if (input.isAtField(FieldNames.index)) { + if (!input.trySkipNullValue()) { + index = input.readUInt32(); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + case 96511: { + if (input.isAtField(FieldNames.age)) { + if (!input.trySkipNullValue()) { + age = input.readUInt32(); + bitField0_ |= 0x00000008; + } + } else { + input.skipUnknownField(); + } + break; + } + case -748916528: { + if (input.isAtField(FieldNames.isActive)) { + if (!input.trySkipNullValue()) { + isActive = input.readBool(); + bitField0_ |= 0x00000010; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3355: { + if (input.isAtField(FieldNames.id)) { + if (!input.trySkipNullValue()) { + input.readString(id); + bitField0_ |= 0x00000020; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3184265: { + if (input.isAtField(FieldNames.guid)) { + if (!input.trySkipNullValue()) { + input.readString(guid); + bitField0_ |= 0x00000040; + } + } else { + input.skipUnknownField(); + } + break; + } + case -339185956: { + if (input.isAtField(FieldNames.balance)) { + if (!input.trySkipNullValue()) { + input.readString(balance); + bitField0_ |= 0x00000080; + } + } else { + input.skipUnknownField(); + } + break; + } + case -577741570: { + if (input.isAtField(FieldNames.picture)) { + if (!input.trySkipNullValue()) { + input.readString(picture); + bitField0_ |= 0x00000100; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1394185294: { + if (input.isAtField(FieldNames.eyeColor)) { + if (!input.trySkipNullValue()) { + input.readString(eyeColor); + bitField0_ |= 0x00000200; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3373707: { + if (input.isAtField(FieldNames.name)) { + if (!input.trySkipNullValue()) { + input.readString(name); + bitField0_ |= 0x00000400; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1249512767: { + if (input.isAtField(FieldNames.gender)) { + if (!input.trySkipNullValue()) { + input.readString(gender); + bitField0_ |= 0x00000800; + } + } else { + input.skipUnknownField(); + } + break; + } + case 950484093: { + if (input.isAtField(FieldNames.company)) { + if (!input.trySkipNullValue()) { + input.readString(company); + bitField0_ |= 0x00001000; + } + } else { + input.skipUnknownField(); + } + break; + } + case 96619420: { + if (input.isAtField(FieldNames.email)) { + if (!input.trySkipNullValue()) { + input.readString(email); + bitField0_ |= 0x00002000; + } + } else { + input.skipUnknownField(); + } + break; + } + case 106642798: { + if (input.isAtField(FieldNames.phone)) { + if (!input.trySkipNullValue()) { + input.readString(phone); + bitField0_ |= 0x00004000; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1147692044: { + if (input.isAtField(FieldNames.address)) { + if (!input.trySkipNullValue()) { + input.readString(address); + bitField0_ |= 0x00008000; + } + } else { + input.skipUnknownField(); + } + break; + } + case 92611469: { + if (input.isAtField(FieldNames.about)) { + if (!input.trySkipNullValue()) { + input.readString(about); + bitField0_ |= 0x00010000; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1869930878: { + if (input.isAtField(FieldNames.registered)) { + if (!input.trySkipNullValue()) { + input.readString(registered); + bitField0_ |= 0x00020000; + } + } else { + input.skipUnknownField(); + } + break; + } + case 205422649: { + if (input.isAtField(FieldNames.greeting)) { + if (!input.trySkipNullValue()) { + input.readString(greeting); + bitField0_ |= 0x00040000; + } + } else { + input.skipUnknownField(); + } + break; + } + case -900211752: { + if (input.isAtField(FieldNames.favoriteFruit)) { + if (!input.trySkipNullValue()) { + input.readString(favoriteFruit); + bitField0_ |= 0x00080000; + } + } else { + input.skipUnknownField(); + } + break; + } + case -600094315: { + if (input.isAtField(FieldNames.friends)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(friends); + bitField0_ |= 0x00100000; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3552281: { + if (input.isAtField(FieldNames.tags)) { + if (!input.trySkipNullValue()) { + input.readRepeatedString(tags); + bitField0_ |= 0x00200000; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public User clone() { + return new User().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static User parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new User(), data).checkInitialized(); + } + + public static User parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new User(), input).checkInitialized(); + } + + public static User parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new User(), input).checkInitialized(); + } + + /** + * @return factory for creating User messages + */ + public static MessageFactory getFactory() { + return UserFactory.INSTANCE; + } + + private enum UserFactory implements MessageFactory { + INSTANCE; + + @Override + public User create() { + return User.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName latitude = FieldName.forField("latitude"); + + static final FieldName longitude = FieldName.forField("longitude"); + + static final FieldName index = FieldName.forField("index"); + + static final FieldName age = FieldName.forField("age"); + + static final FieldName isActive = FieldName.forField("isActive"); + + static final FieldName id = FieldName.forField("id"); + + static final FieldName guid = FieldName.forField("guid"); + + static final FieldName balance = FieldName.forField("balance"); + + static final FieldName picture = FieldName.forField("picture"); + + static final FieldName eyeColor = FieldName.forField("eyeColor"); + + static final FieldName name = FieldName.forField("name"); + + static final FieldName gender = FieldName.forField("gender"); + + static final FieldName company = FieldName.forField("company"); + + static final FieldName email = FieldName.forField("email"); + + static final FieldName phone = FieldName.forField("phone"); + + static final FieldName address = FieldName.forField("address"); + + static final FieldName about = FieldName.forField("about"); + + static final FieldName registered = FieldName.forField("registered"); + + static final FieldName greeting = FieldName.forField("greeting"); + + static final FieldName favoriteFruit = FieldName.forField("favoriteFruit"); + + static final FieldName friends = FieldName.forField("friends"); + + static final FieldName tags = FieldName.forField("tags"); + } + } + + /** + * Protobuf type {@code Friend} + */ + public static final class Friend extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * required string id = 1; + */ + private final Utf8String id = Utf8String.newEmptyInstance(); + + /** + * required string name = 2; + */ + private final Utf8String name = Utf8String.newEmptyInstance(); + + private Friend() { + } + + /** + * @return a new empty instance of {@code Friend} + */ + public static Friend newInstance() { + return new Friend(); + } + + /** + * required string id = 1; + * @return whether the id field is set + */ + public boolean hasId() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * required string id = 1; + * @return this + */ + public Friend clearId() { + bitField0_ &= ~0x00000001; + id.clear(); + return this; + } + + /** + * required string id = 1; + * @return the id + */ + public String getId() { + return id.getString(); + } + + /** + * required string id = 1; + * @return internal {@code Utf8String} representation of id for reading + */ + public Utf8String getIdBytes() { + return this.id; + } + + /** + * required string id = 1; + * @return internal {@code Utf8String} representation of id for modifications + */ + public Utf8String getMutableIdBytes() { + bitField0_ |= 0x00000001; + return this.id; + } + + /** + * required string id = 1; + * @param value the id to set + * @return this + */ + public Friend setId(final CharSequence value) { + bitField0_ |= 0x00000001; + id.copyFrom(value); + return this; + } + + /** + * required string id = 1; + * @param value the id to set + * @return this + */ + public Friend setId(final Utf8String value) { + bitField0_ |= 0x00000001; + id.copyFrom(value); + return this; + } + + /** + * required string name = 2; + * @return whether the name field is set + */ + public boolean hasName() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * required string name = 2; + * @return this + */ + public Friend clearName() { + bitField0_ &= ~0x00000002; + name.clear(); + return this; + } + + /** + * required string name = 2; + * @return the name + */ + public String getName() { + return name.getString(); + } + + /** + * required string name = 2; + * @return internal {@code Utf8String} representation of name for reading + */ + public Utf8String getNameBytes() { + return this.name; + } + + /** + * required string name = 2; + * @return internal {@code Utf8String} representation of name for modifications + */ + public Utf8String getMutableNameBytes() { + bitField0_ |= 0x00000002; + return this.name; + } + + /** + * required string name = 2; + * @param value the name to set + * @return this + */ + public Friend setName(final CharSequence value) { + bitField0_ |= 0x00000002; + name.copyFrom(value); + return this; + } + + /** + * required string name = 2; + * @param value the name to set + * @return this + */ + public Friend setName(final Utf8String value) { + bitField0_ |= 0x00000002; + name.copyFrom(value); + return this; + } + + @Override + public Friend copyFrom(final Friend other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + id.copyFrom(other.id); + name.copyFrom(other.name); + } + return this; + } + + @Override + public Friend mergeFrom(final Friend other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasId()) { + getMutableIdBytes().copyFrom(other.id); + } + if (other.hasName()) { + getMutableNameBytes().copyFrom(other.name); + } + return this; + } + + @Override + public Friend clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + id.clear(); + name.clear(); + return this; + } + + @Override + public Friend clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + id.clear(); + name.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Friend)) { + return false; + } + Friend other = (Friend) o; + return bitField0_ == other.bitField0_ + && (!hasId() || id.equals(other.id)) + && (!hasName() || name.equals(other.name)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((((bitField0_ & 0x00000003) != 0x00000003))) { + throw new UninitializedMessageException(this); + } + try { + output.writeRawByte((byte) 10); + output.writeStringNoTag(id); + output.writeRawByte((byte) 18); + output.writeStringNoTag(name); + } catch (UninitializedMessageException nestedFail) { + throw rethrowFromParent(nestedFail); + } + } + + @Override + protected int computeSerializedSize() { + if ((((bitField0_ & 0x00000003) != 0x00000003))) { + throw new UninitializedMessageException(this); + } + try { + int size = 0; + size += 1 + ProtoSink.computeStringSizeNoTag(id); + size += 1 + ProtoSink.computeStringSizeNoTag(name); + return size; + } catch (UninitializedMessageException nestedFail) { + throw rethrowFromParent(nestedFail); + } + } + + @Override + @SuppressWarnings("fallthrough") + public Friend mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 10: { + // id + input.readString(id); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 18) { + break; + } + } + case 18: { + // name + input.readString(name); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public final boolean isInitialized() { + if ((((bitField0_ & 0x00000003) != 0x00000003))) { + return false; + } + return true; + } + + @Override + protected final void getMissingFields(String prefix, List results) { + if (!hasId()) { + results.add(prefix + "id"); + } + if (!hasName()) { + results.add(prefix + "name"); + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + if ((((bitField0_ & 0x00000003) != 0x00000003))) { + throw new UninitializedMessageException(this); + } + try { + output.beginObject(); + output.writeString(FieldNames.id, id); + output.writeString(FieldNames.name, name); + output.endObject(); + } catch (UninitializedMessageException nestedFail) { + throw rethrowFromParent(nestedFail); + } + } + + @Override + public Friend mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 3355: { + if (input.isAtField(FieldNames.id)) { + if (!input.trySkipNullValue()) { + input.readString(id); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3373707: { + if (input.isAtField(FieldNames.name)) { + if (!input.trySkipNullValue()) { + input.readString(name); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public Friend clone() { + return new Friend().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static Friend parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new Friend(), data).checkInitialized(); + } + + public static Friend parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new Friend(), input).checkInitialized(); + } + + public static Friend parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new Friend(), input).checkInitialized(); + } + + /** + * @return factory for creating Friend messages + */ + public static MessageFactory getFactory() { + return FriendFactory.INSTANCE; + } + + private enum FriendFactory implements MessageFactory { + INSTANCE; + + @Override + public Friend create() { + return Friend.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName id = FieldName.forField("id"); + + static final FieldName name = FieldName.forField("name"); + } + } + + private enum UsersFactory implements MessageFactory { + INSTANCE; + + @Override + public Users create() { + return Users.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName users = FieldName.forField("users"); + } + } + + /** + * Protobuf type {@code Clients} + */ + public static final class Clients extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * repeated .quickbuf_unittest.Clients.Client clients = 1; + */ + private final RepeatedMessage clients = RepeatedMessage.newEmptyInstance(Client.getFactory()); + + private Clients() { + } + + /** + * @return a new empty instance of {@code Clients} + */ + public static Clients newInstance() { + return new Clients(); + } + + /** + * repeated .quickbuf_unittest.Clients.Client clients = 1; + * @return whether the clients field is set + */ + public boolean hasClients() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * repeated .quickbuf_unittest.Clients.Client clients = 1; + * @return this + */ + public Clients clearClients() { + bitField0_ &= ~0x00000001; + clients.clear(); + return this; + } + + /** + * repeated .quickbuf_unittest.Clients.Client clients = 1; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableClients()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getClients() { + return clients; + } + + /** + * repeated .quickbuf_unittest.Clients.Client clients = 1; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedMessage getMutableClients() { + bitField0_ |= 0x00000001; + return clients; + } + + /** + * repeated .quickbuf_unittest.Clients.Client clients = 1; + * @param value the clients to add + * @return this + */ + public Clients addClients(final Client value) { + bitField0_ |= 0x00000001; + clients.add(value); + return this; + } + + /** + * repeated .quickbuf_unittest.Clients.Client clients = 1; + * @param values the clients to add + * @return this + */ + public Clients addAllClients(final Client... values) { + bitField0_ |= 0x00000001; + clients.addAll(values); + return this; + } + + @Override + public Clients copyFrom(final Clients other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + clients.copyFrom(other.clients); + } + return this; + } + + @Override + public Clients mergeFrom(final Clients other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasClients()) { + getMutableClients().addAll(other.clients); + } + return this; + } + + @Override + public Clients clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + clients.clear(); + return this; + } + + @Override + public Clients clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + clients.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Clients)) { + return false; + } + Clients other = (Clients) o; + return bitField0_ == other.bitField0_ + && (!hasClients() || clients.equals(other.clients)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + for (int i = 0; i < clients.length(); i++) { + output.writeRawByte((byte) 10); + output.writeMessageNoTag(clients.get(i)); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += (1 * clients.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(clients); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public Clients mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 10: { + // clients + tag = input.readRepeatedMessage(clients, tag); + bitField0_ |= 0x00000001; + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeRepeatedMessage(FieldNames.clients, clients); + } + output.endObject(); + } + + @Override + public Clients mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 860587528: { + if (input.isAtField(FieldNames.clients)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(clients); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public Clients clone() { + return new Clients().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static Clients parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new Clients(), data).checkInitialized(); + } + + public static Clients parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new Clients(), input).checkInitialized(); + } + + public static Clients parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new Clients(), input).checkInitialized(); + } + + /** + * @return factory for creating Clients messages + */ + public static MessageFactory getFactory() { + return ClientsFactory.INSTANCE; + } + + /** + * Protobuf enum {@code EyeColor} + */ + public enum EyeColor implements ProtoEnum { + /** + * BROWN = 1; + */ + BROWN("BROWN", 1), + + /** + * BLUE = 2; + */ + BLUE("BLUE", 2), + + /** + * GREEN = 3; + */ + GREEN("GREEN", 3); + + /** + * BROWN = 1; + */ + public static final int BROWN_VALUE = 1; + + /** + * BLUE = 2; + */ + public static final int BLUE_VALUE = 2; + + /** + * GREEN = 3; + */ + public static final int GREEN_VALUE = 3; + + private final String name; + + private final int number; + + private EyeColor(String name, int number) { + this.name = name; + this.number = number; + } + + /** + * @return the string representation of enum entry + */ + @Override + public String getName() { + return name; + } + + /** + * @return the numeric wire value of this enum entry + */ + @Override + public int getNumber() { + return number; + } + + /** + * @return a converter that maps between this enum's numeric and text representations + */ + public static ProtoEnum.EnumConverter converter() { + return EyeColorConverter.INSTANCE; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value, or null if unknown. + */ + public static EyeColor forNumber(int value) { + return EyeColorConverter.INSTANCE.forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @param other Fallback value in case the value is not known. + * @return The enum associated with the given numeric wire value, or the fallback value if unknown. + */ + public static EyeColor forNumberOr(int number, EyeColor other) { + EyeColor value = forNumber(number); + return value == null ? other : value; + } + + enum EyeColorConverter implements ProtoEnum.EnumConverter { + INSTANCE; + + private static final EyeColor[] lookup = new EyeColor[4]; + + static { + lookup[1] = BROWN; + lookup[2] = BLUE; + lookup[3] = GREEN; + } + + @Override + public final EyeColor forNumber(final int value) { + if (value >= 0 && value < lookup.length) { + return lookup[value]; + } + return null; + } + + @Override + public final EyeColor forName(final CharSequence value) { + if (value.length() == 4) { + if (ProtoUtil.isEqual("BLUE", value)) { + return BLUE; + } + } + if (value.length() == 5) { + if (ProtoUtil.isEqual("BROWN", value)) { + return BROWN; + } + if (ProtoUtil.isEqual("GREEN", value)) { + return GREEN; + } + } + return null; + } + } + } + + /** + * Protobuf type {@code Client} + */ + public static final class Client extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + *
+             *  BigDecimal
+             * 
+ * + * optional double balance = 5; + */ + private double balance; + + /** + * optional double latitude = 17; + */ + private double latitude; + + /** + * optional double longitude = 18; + */ + private double longitude; + + /** + * optional uint64 id = 1; + */ + private long id; + + /** + * optional uint32 index = 2; + */ + private int index; + + /** + * optional uint32 age = 7; + */ + private int age; + + /** + *
+             *  enum
+             * 
+ * + * optional .quickbuf_unittest.Clients.EyeColor eyeColor = 8; + */ + private int eyeColor; + + /** + * optional bool isActive = 4; + */ + private boolean isActive; + + /** + * optional string guid = 3; + */ + private final Utf8String guid = Utf8String.newEmptyInstance(); + + /** + * optional string picture = 6; + */ + private final Utf8String picture = Utf8String.newEmptyInstance(); + + /** + * optional string name = 9; + */ + private final Utf8String name = Utf8String.newEmptyInstance(); + + /** + * optional string gender = 10; + */ + private final Utf8String gender = Utf8String.newEmptyInstance(); + + /** + * optional string company = 11; + */ + private final Utf8String company = Utf8String.newEmptyInstance(); + + /** + * optional string address = 14; + */ + private final Utf8String address = Utf8String.newEmptyInstance(); + + /** + * optional string about = 15; + */ + private final Utf8String about = Utf8String.newEmptyInstance(); + + /** + * optional string registered = 16; + */ + private final Utf8String registered = Utf8String.newEmptyInstance(); + + /** + * repeated fixed64 phones = 13; + */ + private final RepeatedLong phones = RepeatedLong.newEmptyInstance(); + + /** + * repeated .quickbuf_unittest.Clients.Partner partners = 20; + */ + private final RepeatedMessage partners = RepeatedMessage.newEmptyInstance(Partner.getFactory()); + + /** + * repeated string emails = 12; + */ + private final RepeatedString emails = RepeatedString.newEmptyInstance(); + + /** + * repeated string tags = 19; + */ + private final RepeatedString tags = RepeatedString.newEmptyInstance(); + + private Client() { + } + + /** + * @return a new empty instance of {@code Client} + */ + public static Client newInstance() { + return new Client(); + } + + /** + *
+             *  BigDecimal
+             * 
+ * + * optional double balance = 5; + * @return whether the balance field is set + */ + public boolean hasBalance() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + *
+             *  BigDecimal
+             * 
+ * + * optional double balance = 5; + * @return this + */ + public Client clearBalance() { + bitField0_ &= ~0x00000001; + balance = 0D; + return this; + } + + /** + *
+             *  BigDecimal
+             * 
+ * + * optional double balance = 5; + * @return the balance + */ + public double getBalance() { + return balance; + } + + /** + *
+             *  BigDecimal
+             * 
+ * + * optional double balance = 5; + * @param value the balance to set + * @return this + */ + public Client setBalance(final double value) { + bitField0_ |= 0x00000001; + balance = value; + return this; + } + + /** + * optional double latitude = 17; + * @return whether the latitude field is set + */ + public boolean hasLatitude() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional double latitude = 17; + * @return this + */ + public Client clearLatitude() { + bitField0_ &= ~0x00000002; + latitude = 0D; + return this; + } + + /** + * optional double latitude = 17; + * @return the latitude + */ + public double getLatitude() { + return latitude; + } + + /** + * optional double latitude = 17; + * @param value the latitude to set + * @return this + */ + public Client setLatitude(final double value) { + bitField0_ |= 0x00000002; + latitude = value; + return this; + } + + /** + * optional double longitude = 18; + * @return whether the longitude field is set + */ + public boolean hasLongitude() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional double longitude = 18; + * @return this + */ + public Client clearLongitude() { + bitField0_ &= ~0x00000004; + longitude = 0D; + return this; + } + + /** + * optional double longitude = 18; + * @return the longitude + */ + public double getLongitude() { + return longitude; + } + + /** + * optional double longitude = 18; + * @param value the longitude to set + * @return this + */ + public Client setLongitude(final double value) { + bitField0_ |= 0x00000004; + longitude = value; + return this; + } + + /** + * optional uint64 id = 1; + * @return whether the id field is set + */ + public boolean hasId() { + return (bitField0_ & 0x00000008) != 0; + } + + /** + * optional uint64 id = 1; + * @return this + */ + public Client clearId() { + bitField0_ &= ~0x00000008; + id = 0L; + return this; + } + + /** + * optional uint64 id = 1; + * @return the id + */ + public long getId() { + return id; + } + + /** + * optional uint64 id = 1; + * @param value the id to set + * @return this + */ + public Client setId(final long value) { + bitField0_ |= 0x00000008; + id = value; + return this; + } + + /** + * optional uint32 index = 2; + * @return whether the index field is set + */ + public boolean hasIndex() { + return (bitField0_ & 0x00000010) != 0; + } + + /** + * optional uint32 index = 2; + * @return this + */ + public Client clearIndex() { + bitField0_ &= ~0x00000010; + index = 0; + return this; + } + + /** + * optional uint32 index = 2; + * @return the index + */ + public int getIndex() { + return index; + } + + /** + * optional uint32 index = 2; + * @param value the index to set + * @return this + */ + public Client setIndex(final int value) { + bitField0_ |= 0x00000010; + index = value; + return this; + } + + /** + * optional uint32 age = 7; + * @return whether the age field is set + */ + public boolean hasAge() { + return (bitField0_ & 0x00000020) != 0; + } + + /** + * optional uint32 age = 7; + * @return this + */ + public Client clearAge() { + bitField0_ &= ~0x00000020; + age = 0; + return this; + } + + /** + * optional uint32 age = 7; + * @return the age + */ + public int getAge() { + return age; + } + + /** + * optional uint32 age = 7; + * @param value the age to set + * @return this + */ + public Client setAge(final int value) { + bitField0_ |= 0x00000020; + age = value; + return this; + } + + /** + *
+             *  enum
+             * 
+ * + * optional .quickbuf_unittest.Clients.EyeColor eyeColor = 8; + * @return whether the eyeColor field is set + */ + public boolean hasEyeColor() { + return (bitField0_ & 0x00000040) != 0; + } + + /** + *
+             *  enum
+             * 
+ * + * optional .quickbuf_unittest.Clients.EyeColor eyeColor = 8; + * @return this + */ + public Client clearEyeColor() { + bitField0_ &= ~0x00000040; + eyeColor = 0; + return this; + } + + /** + *
+             *  enum
+             * 
+ * + * optional .quickbuf_unittest.Clients.EyeColor eyeColor = 8; + * @return the eyeColor + */ + public EyeColor getEyeColor() { + return EyeColor.forNumber(eyeColor); + } + + /** + * Gets the value of the internal enum store. The result is + * equivalent to {@link Client#getEyeColor()}.getNumber(). + * + * @return numeric wire representation + */ + public int getEyeColorValue() { + return eyeColor; + } + + /** + * Sets the value of the internal enum store. This does not + * do any validity checks, so be sure to use appropriate value + * constants from {@link EyeColor}. Setting an invalid value + * can cause {@link Client#getEyeColor()} to return null + * + * @param value the numeric wire value to set + * @return this + */ + public Client setEyeColorValue(final int value) { + bitField0_ |= 0x00000040; + eyeColor = value; + return this; + } + + /** + *
+             *  enum
+             * 
+ * + * optional .quickbuf_unittest.Clients.EyeColor eyeColor = 8; + * @param value the eyeColor to set + * @return this + */ + public Client setEyeColor(final EyeColor value) { + bitField0_ |= 0x00000040; + eyeColor = value.getNumber(); + return this; + } + + /** + * optional bool isActive = 4; + * @return whether the isActive field is set + */ + public boolean hasIsActive() { + return (bitField0_ & 0x00000080) != 0; + } + + /** + * optional bool isActive = 4; + * @return this + */ + public Client clearIsActive() { + bitField0_ &= ~0x00000080; + isActive = false; + return this; + } + + /** + * optional bool isActive = 4; + * @return the isActive + */ + public boolean getIsActive() { + return isActive; + } + + /** + * optional bool isActive = 4; + * @param value the isActive to set + * @return this + */ + public Client setIsActive(final boolean value) { + bitField0_ |= 0x00000080; + isActive = value; + return this; + } + + /** + * optional string guid = 3; + * @return whether the guid field is set + */ + public boolean hasGuid() { + return (bitField0_ & 0x00000100) != 0; + } + + /** + * optional string guid = 3; + * @return this + */ + public Client clearGuid() { + bitField0_ &= ~0x00000100; + guid.clear(); + return this; + } + + /** + * optional string guid = 3; + * @return the guid + */ + public String getGuid() { + return guid.getString(); + } + + /** + * optional string guid = 3; + * @return internal {@code Utf8String} representation of guid for reading + */ + public Utf8String getGuidBytes() { + return this.guid; + } + + /** + * optional string guid = 3; + * @return internal {@code Utf8String} representation of guid for modifications + */ + public Utf8String getMutableGuidBytes() { + bitField0_ |= 0x00000100; + return this.guid; + } + + /** + * optional string guid = 3; + * @param value the guid to set + * @return this + */ + public Client setGuid(final CharSequence value) { + bitField0_ |= 0x00000100; + guid.copyFrom(value); + return this; + } + + /** + * optional string guid = 3; + * @param value the guid to set + * @return this + */ + public Client setGuid(final Utf8String value) { + bitField0_ |= 0x00000100; + guid.copyFrom(value); + return this; + } + + /** + * optional string picture = 6; + * @return whether the picture field is set + */ + public boolean hasPicture() { + return (bitField0_ & 0x00000200) != 0; + } + + /** + * optional string picture = 6; + * @return this + */ + public Client clearPicture() { + bitField0_ &= ~0x00000200; + picture.clear(); + return this; + } + + /** + * optional string picture = 6; + * @return the picture + */ + public String getPicture() { + return picture.getString(); + } + + /** + * optional string picture = 6; + * @return internal {@code Utf8String} representation of picture for reading + */ + public Utf8String getPictureBytes() { + return this.picture; + } + + /** + * optional string picture = 6; + * @return internal {@code Utf8String} representation of picture for modifications + */ + public Utf8String getMutablePictureBytes() { + bitField0_ |= 0x00000200; + return this.picture; + } + + /** + * optional string picture = 6; + * @param value the picture to set + * @return this + */ + public Client setPicture(final CharSequence value) { + bitField0_ |= 0x00000200; + picture.copyFrom(value); + return this; + } + + /** + * optional string picture = 6; + * @param value the picture to set + * @return this + */ + public Client setPicture(final Utf8String value) { + bitField0_ |= 0x00000200; + picture.copyFrom(value); + return this; + } + + /** + * optional string name = 9; + * @return whether the name field is set + */ + public boolean hasName() { + return (bitField0_ & 0x00000400) != 0; + } + + /** + * optional string name = 9; + * @return this + */ + public Client clearName() { + bitField0_ &= ~0x00000400; + name.clear(); + return this; + } + + /** + * optional string name = 9; + * @return the name + */ + public String getName() { + return name.getString(); + } + + /** + * optional string name = 9; + * @return internal {@code Utf8String} representation of name for reading + */ + public Utf8String getNameBytes() { + return this.name; + } + + /** + * optional string name = 9; + * @return internal {@code Utf8String} representation of name for modifications + */ + public Utf8String getMutableNameBytes() { + bitField0_ |= 0x00000400; + return this.name; + } + + /** + * optional string name = 9; + * @param value the name to set + * @return this + */ + public Client setName(final CharSequence value) { + bitField0_ |= 0x00000400; + name.copyFrom(value); + return this; + } + + /** + * optional string name = 9; + * @param value the name to set + * @return this + */ + public Client setName(final Utf8String value) { + bitField0_ |= 0x00000400; + name.copyFrom(value); + return this; + } + + /** + * optional string gender = 10; + * @return whether the gender field is set + */ + public boolean hasGender() { + return (bitField0_ & 0x00000800) != 0; + } + + /** + * optional string gender = 10; + * @return this + */ + public Client clearGender() { + bitField0_ &= ~0x00000800; + gender.clear(); + return this; + } + + /** + * optional string gender = 10; + * @return the gender + */ + public String getGender() { + return gender.getString(); + } + + /** + * optional string gender = 10; + * @return internal {@code Utf8String} representation of gender for reading + */ + public Utf8String getGenderBytes() { + return this.gender; + } + + /** + * optional string gender = 10; + * @return internal {@code Utf8String} representation of gender for modifications + */ + public Utf8String getMutableGenderBytes() { + bitField0_ |= 0x00000800; + return this.gender; + } + + /** + * optional string gender = 10; + * @param value the gender to set + * @return this + */ + public Client setGender(final CharSequence value) { + bitField0_ |= 0x00000800; + gender.copyFrom(value); + return this; + } + + /** + * optional string gender = 10; + * @param value the gender to set + * @return this + */ + public Client setGender(final Utf8String value) { + bitField0_ |= 0x00000800; + gender.copyFrom(value); + return this; + } + + /** + * optional string company = 11; + * @return whether the company field is set + */ + public boolean hasCompany() { + return (bitField0_ & 0x00001000) != 0; + } + + /** + * optional string company = 11; + * @return this + */ + public Client clearCompany() { + bitField0_ &= ~0x00001000; + company.clear(); + return this; + } + + /** + * optional string company = 11; + * @return the company + */ + public String getCompany() { + return company.getString(); + } + + /** + * optional string company = 11; + * @return internal {@code Utf8String} representation of company for reading + */ + public Utf8String getCompanyBytes() { + return this.company; + } + + /** + * optional string company = 11; + * @return internal {@code Utf8String} representation of company for modifications + */ + public Utf8String getMutableCompanyBytes() { + bitField0_ |= 0x00001000; + return this.company; + } + + /** + * optional string company = 11; + * @param value the company to set + * @return this + */ + public Client setCompany(final CharSequence value) { + bitField0_ |= 0x00001000; + company.copyFrom(value); + return this; + } + + /** + * optional string company = 11; + * @param value the company to set + * @return this + */ + public Client setCompany(final Utf8String value) { + bitField0_ |= 0x00001000; + company.copyFrom(value); + return this; + } + + /** + * optional string address = 14; + * @return whether the address field is set + */ + public boolean hasAddress() { + return (bitField0_ & 0x00002000) != 0; + } + + /** + * optional string address = 14; + * @return this + */ + public Client clearAddress() { + bitField0_ &= ~0x00002000; + address.clear(); + return this; + } + + /** + * optional string address = 14; + * @return the address + */ + public String getAddress() { + return address.getString(); + } + + /** + * optional string address = 14; + * @return internal {@code Utf8String} representation of address for reading + */ + public Utf8String getAddressBytes() { + return this.address; + } + + /** + * optional string address = 14; + * @return internal {@code Utf8String} representation of address for modifications + */ + public Utf8String getMutableAddressBytes() { + bitField0_ |= 0x00002000; + return this.address; + } + + /** + * optional string address = 14; + * @param value the address to set + * @return this + */ + public Client setAddress(final CharSequence value) { + bitField0_ |= 0x00002000; + address.copyFrom(value); + return this; + } + + /** + * optional string address = 14; + * @param value the address to set + * @return this + */ + public Client setAddress(final Utf8String value) { + bitField0_ |= 0x00002000; + address.copyFrom(value); + return this; + } + + /** + * optional string about = 15; + * @return whether the about field is set + */ + public boolean hasAbout() { + return (bitField0_ & 0x00004000) != 0; + } + + /** + * optional string about = 15; + * @return this + */ + public Client clearAbout() { + bitField0_ &= ~0x00004000; + about.clear(); + return this; + } + + /** + * optional string about = 15; + * @return the about + */ + public String getAbout() { + return about.getString(); + } + + /** + * optional string about = 15; + * @return internal {@code Utf8String} representation of about for reading + */ + public Utf8String getAboutBytes() { + return this.about; + } + + /** + * optional string about = 15; + * @return internal {@code Utf8String} representation of about for modifications + */ + public Utf8String getMutableAboutBytes() { + bitField0_ |= 0x00004000; + return this.about; + } + + /** + * optional string about = 15; + * @param value the about to set + * @return this + */ + public Client setAbout(final CharSequence value) { + bitField0_ |= 0x00004000; + about.copyFrom(value); + return this; + } + + /** + * optional string about = 15; + * @param value the about to set + * @return this + */ + public Client setAbout(final Utf8String value) { + bitField0_ |= 0x00004000; + about.copyFrom(value); + return this; + } + + /** + * optional string registered = 16; + * @return whether the registered field is set + */ + public boolean hasRegistered() { + return (bitField0_ & 0x00008000) != 0; + } + + /** + * optional string registered = 16; + * @return this + */ + public Client clearRegistered() { + bitField0_ &= ~0x00008000; + registered.clear(); + return this; + } + + /** + * optional string registered = 16; + * @return the registered + */ + public String getRegistered() { + return registered.getString(); + } + + /** + * optional string registered = 16; + * @return internal {@code Utf8String} representation of registered for reading + */ + public Utf8String getRegisteredBytes() { + return this.registered; + } + + /** + * optional string registered = 16; + * @return internal {@code Utf8String} representation of registered for modifications + */ + public Utf8String getMutableRegisteredBytes() { + bitField0_ |= 0x00008000; + return this.registered; + } + + /** + * optional string registered = 16; + * @param value the registered to set + * @return this + */ + public Client setRegistered(final CharSequence value) { + bitField0_ |= 0x00008000; + registered.copyFrom(value); + return this; + } + + /** + * optional string registered = 16; + * @param value the registered to set + * @return this + */ + public Client setRegistered(final Utf8String value) { + bitField0_ |= 0x00008000; + registered.copyFrom(value); + return this; + } + + /** + * repeated fixed64 phones = 13; + * @return whether the phones field is set + */ + public boolean hasPhones() { + return (bitField0_ & 0x00010000) != 0; + } + + /** + * repeated fixed64 phones = 13; + * @return this + */ + public Client clearPhones() { + bitField0_ &= ~0x00010000; + phones.clear(); + return this; + } + + /** + * repeated fixed64 phones = 13; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutablePhones()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedLong getPhones() { + return phones; + } + + /** + * repeated fixed64 phones = 13; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedLong getMutablePhones() { + bitField0_ |= 0x00010000; + return phones; + } + + /** + * repeated fixed64 phones = 13; + * @param value the phones to add + * @return this + */ + public Client addPhones(final long value) { + bitField0_ |= 0x00010000; + phones.add(value); + return this; + } + + /** + * repeated fixed64 phones = 13; + * @param values the phones to add + * @return this + */ + public Client addAllPhones(final long... values) { + bitField0_ |= 0x00010000; + phones.addAll(values); + return this; + } + + /** + * repeated .quickbuf_unittest.Clients.Partner partners = 20; + * @return whether the partners field is set + */ + public boolean hasPartners() { + return (bitField0_ & 0x00020000) != 0; + } + + /** + * repeated .quickbuf_unittest.Clients.Partner partners = 20; + * @return this + */ + public Client clearPartners() { + bitField0_ &= ~0x00020000; + partners.clear(); + return this; + } + + /** + * repeated .quickbuf_unittest.Clients.Partner partners = 20; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutablePartners()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getPartners() { + return partners; + } + + /** + * repeated .quickbuf_unittest.Clients.Partner partners = 20; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedMessage getMutablePartners() { + bitField0_ |= 0x00020000; + return partners; + } + + /** + * repeated .quickbuf_unittest.Clients.Partner partners = 20; + * @param value the partners to add + * @return this + */ + public Client addPartners(final Partner value) { + bitField0_ |= 0x00020000; + partners.add(value); + return this; + } + + /** + * repeated .quickbuf_unittest.Clients.Partner partners = 20; + * @param values the partners to add + * @return this + */ + public Client addAllPartners(final Partner... values) { + bitField0_ |= 0x00020000; + partners.addAll(values); + return this; + } + + /** + * repeated string emails = 12; + * @return whether the emails field is set + */ + public boolean hasEmails() { + return (bitField0_ & 0x00040000) != 0; + } + + /** + * repeated string emails = 12; + * @return this + */ + public Client clearEmails() { + bitField0_ &= ~0x00040000; + emails.clear(); + return this; + } + + /** + * repeated string emails = 12; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableEmails()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedString getEmails() { + return emails; + } + + /** + * repeated string emails = 12; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedString getMutableEmails() { + bitField0_ |= 0x00040000; + return emails; + } + + /** + * repeated string emails = 12; + * @param value the emails to add + * @return this + */ + public Client addEmails(final CharSequence value) { + bitField0_ |= 0x00040000; + emails.add(value); + return this; + } + + /** + * repeated string emails = 12; + * @param values the emails to add + * @return this + */ + public Client addAllEmails(final CharSequence... values) { + bitField0_ |= 0x00040000; + emails.addAll(values); + return this; + } + + /** + * repeated string tags = 19; + * @return whether the tags field is set + */ + public boolean hasTags() { + return (bitField0_ & 0x00080000) != 0; + } + + /** + * repeated string tags = 19; + * @return this + */ + public Client clearTags() { + bitField0_ &= ~0x00080000; + tags.clear(); + return this; + } + + /** + * repeated string tags = 19; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableTags()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedString getTags() { + return tags; + } + + /** + * repeated string tags = 19; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedString getMutableTags() { + bitField0_ |= 0x00080000; + return tags; + } + + /** + * repeated string tags = 19; + * @param value the tags to add + * @return this + */ + public Client addTags(final CharSequence value) { + bitField0_ |= 0x00080000; + tags.add(value); + return this; + } + + /** + * repeated string tags = 19; + * @param values the tags to add + * @return this + */ + public Client addAllTags(final CharSequence... values) { + bitField0_ |= 0x00080000; + tags.addAll(values); + return this; + } + + @Override + public Client copyFrom(final Client other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + balance = other.balance; + latitude = other.latitude; + longitude = other.longitude; + id = other.id; + index = other.index; + age = other.age; + eyeColor = other.eyeColor; + isActive = other.isActive; + guid.copyFrom(other.guid); + picture.copyFrom(other.picture); + name.copyFrom(other.name); + gender.copyFrom(other.gender); + company.copyFrom(other.company); + address.copyFrom(other.address); + about.copyFrom(other.about); + registered.copyFrom(other.registered); + phones.copyFrom(other.phones); + partners.copyFrom(other.partners); + emails.copyFrom(other.emails); + tags.copyFrom(other.tags); + } + return this; + } + + @Override + public Client mergeFrom(final Client other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasBalance()) { + setBalance(other.balance); + } + if (other.hasLatitude()) { + setLatitude(other.latitude); + } + if (other.hasLongitude()) { + setLongitude(other.longitude); + } + if (other.hasId()) { + setId(other.id); + } + if (other.hasIndex()) { + setIndex(other.index); + } + if (other.hasAge()) { + setAge(other.age); + } + if (other.hasEyeColor()) { + setEyeColorValue(other.eyeColor); + } + if (other.hasIsActive()) { + setIsActive(other.isActive); + } + if (other.hasGuid()) { + getMutableGuidBytes().copyFrom(other.guid); + } + if (other.hasPicture()) { + getMutablePictureBytes().copyFrom(other.picture); + } + if (other.hasName()) { + getMutableNameBytes().copyFrom(other.name); + } + if (other.hasGender()) { + getMutableGenderBytes().copyFrom(other.gender); + } + if (other.hasCompany()) { + getMutableCompanyBytes().copyFrom(other.company); + } + if (other.hasAddress()) { + getMutableAddressBytes().copyFrom(other.address); + } + if (other.hasAbout()) { + getMutableAboutBytes().copyFrom(other.about); + } + if (other.hasRegistered()) { + getMutableRegisteredBytes().copyFrom(other.registered); + } + if (other.hasPhones()) { + getMutablePhones().addAll(other.phones); + } + if (other.hasPartners()) { + getMutablePartners().addAll(other.partners); + } + if (other.hasEmails()) { + getMutableEmails().addAll(other.emails); + } + if (other.hasTags()) { + getMutableTags().addAll(other.tags); + } + return this; + } + + @Override + public Client clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + balance = 0D; + latitude = 0D; + longitude = 0D; + id = 0L; + index = 0; + age = 0; + eyeColor = 0; + isActive = false; + guid.clear(); + picture.clear(); + name.clear(); + gender.clear(); + company.clear(); + address.clear(); + about.clear(); + registered.clear(); + phones.clear(); + partners.clear(); + emails.clear(); + tags.clear(); + return this; + } + + @Override + public Client clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + guid.clear(); + picture.clear(); + name.clear(); + gender.clear(); + company.clear(); + address.clear(); + about.clear(); + registered.clear(); + phones.clear(); + partners.clearQuick(); + emails.clear(); + tags.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Client)) { + return false; + } + Client other = (Client) o; + return bitField0_ == other.bitField0_ + && (!hasBalance() || ProtoUtil.isEqual(balance, other.balance)) + && (!hasLatitude() || ProtoUtil.isEqual(latitude, other.latitude)) + && (!hasLongitude() || ProtoUtil.isEqual(longitude, other.longitude)) + && (!hasId() || id == other.id) + && (!hasIndex() || index == other.index) + && (!hasAge() || age == other.age) + && (!hasEyeColor() || eyeColor == other.eyeColor) + && (!hasIsActive() || isActive == other.isActive) + && (!hasGuid() || guid.equals(other.guid)) + && (!hasPicture() || picture.equals(other.picture)) + && (!hasName() || name.equals(other.name)) + && (!hasGender() || gender.equals(other.gender)) + && (!hasCompany() || company.equals(other.company)) + && (!hasAddress() || address.equals(other.address)) + && (!hasAbout() || about.equals(other.about)) + && (!hasRegistered() || registered.equals(other.registered)) + && (!hasPhones() || phones.equals(other.phones)) + && (!hasPartners() || partners.equals(other.partners)) + && (!hasEmails() || emails.equals(other.emails)) + && (!hasTags() || tags.equals(other.tags)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 41); + output.writeDoubleNoTag(balance); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawLittleEndian16((short) 393); + output.writeDoubleNoTag(latitude); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawLittleEndian16((short) 401); + output.writeDoubleNoTag(longitude); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeRawByte((byte) 8); + output.writeUInt64NoTag(id); + } + if ((bitField0_ & 0x00000010) != 0) { + output.writeRawByte((byte) 16); + output.writeUInt32NoTag(index); + } + if ((bitField0_ & 0x00000020) != 0) { + output.writeRawByte((byte) 56); + output.writeUInt32NoTag(age); + } + if ((bitField0_ & 0x00000040) != 0) { + output.writeRawByte((byte) 64); + output.writeEnumNoTag(eyeColor); + } + if ((bitField0_ & 0x00000080) != 0) { + output.writeRawByte((byte) 32); + output.writeBoolNoTag(isActive); + } + if ((bitField0_ & 0x00000100) != 0) { + output.writeRawByte((byte) 26); + output.writeStringNoTag(guid); + } + if ((bitField0_ & 0x00000200) != 0) { + output.writeRawByte((byte) 50); + output.writeStringNoTag(picture); + } + if ((bitField0_ & 0x00000400) != 0) { + output.writeRawByte((byte) 74); + output.writeStringNoTag(name); + } + if ((bitField0_ & 0x00000800) != 0) { + output.writeRawByte((byte) 82); + output.writeStringNoTag(gender); + } + if ((bitField0_ & 0x00001000) != 0) { + output.writeRawByte((byte) 90); + output.writeStringNoTag(company); + } + if ((bitField0_ & 0x00002000) != 0) { + output.writeRawByte((byte) 114); + output.writeStringNoTag(address); + } + if ((bitField0_ & 0x00004000) != 0) { + output.writeRawByte((byte) 122); + output.writeStringNoTag(about); + } + if ((bitField0_ & 0x00008000) != 0) { + output.writeRawLittleEndian16((short) 386); + output.writeStringNoTag(registered); + } + if ((bitField0_ & 0x00010000) != 0) { + for (int i = 0; i < phones.length(); i++) { + output.writeRawByte((byte) 105); + output.writeFixed64NoTag(phones.array()[i]); + } + } + if ((bitField0_ & 0x00020000) != 0) { + for (int i = 0; i < partners.length(); i++) { + output.writeRawLittleEndian16((short) 418); + output.writeMessageNoTag(partners.get(i)); + } + } + if ((bitField0_ & 0x00040000) != 0) { + for (int i = 0; i < emails.length(); i++) { + output.writeRawByte((byte) 98); + output.writeStringNoTag(emails.get(i)); + } + } + if ((bitField0_ & 0x00080000) != 0) { + for (int i = 0; i < tags.length(); i++) { + output.writeRawLittleEndian16((short) 410); + output.writeStringNoTag(tags.get(i)); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 9; + } + if ((bitField0_ & 0x00000002) != 0) { + size += 10; + } + if ((bitField0_ & 0x00000004) != 0) { + size += 10; + } + if ((bitField0_ & 0x00000008) != 0) { + size += 1 + ProtoSink.computeUInt64SizeNoTag(id); + } + if ((bitField0_ & 0x00000010) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(index); + } + if ((bitField0_ & 0x00000020) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(age); + } + if ((bitField0_ & 0x00000040) != 0) { + size += 1 + ProtoSink.computeEnumSizeNoTag(eyeColor); + } + if ((bitField0_ & 0x00000080) != 0) { + size += 2; + } + if ((bitField0_ & 0x00000100) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(guid); + } + if ((bitField0_ & 0x00000200) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(picture); + } + if ((bitField0_ & 0x00000400) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(name); + } + if ((bitField0_ & 0x00000800) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(gender); + } + if ((bitField0_ & 0x00001000) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(company); + } + if ((bitField0_ & 0x00002000) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(address); + } + if ((bitField0_ & 0x00004000) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(about); + } + if ((bitField0_ & 0x00008000) != 0) { + size += 2 + ProtoSink.computeStringSizeNoTag(registered); + } + if ((bitField0_ & 0x00010000) != 0) { + size += (1 + 8) * phones.length(); + } + if ((bitField0_ & 0x00020000) != 0) { + size += (2 * partners.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(partners); + } + if ((bitField0_ & 0x00040000) != 0) { + size += (1 * emails.length()) + ProtoSink.computeRepeatedStringSizeNoTag(emails); + } + if ((bitField0_ & 0x00080000) != 0) { + size += (2 * tags.length()) + ProtoSink.computeRepeatedStringSizeNoTag(tags); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public Client mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 41: { + // balance + balance = input.readDouble(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 137) { + break; + } + } + case 137: { + // latitude + latitude = input.readDouble(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 145) { + break; + } + } + case 145: { + // longitude + longitude = input.readDouble(); + bitField0_ |= 0x00000004; + tag = input.readTag(); + if (tag != 8) { + break; + } + } + case 8: { + // id + id = input.readUInt64(); + bitField0_ |= 0x00000008; + tag = input.readTag(); + if (tag != 16) { + break; + } + } + case 16: { + // index + index = input.readUInt32(); + bitField0_ |= 0x00000010; + tag = input.readTag(); + if (tag != 56) { + break; + } + } + case 56: { + // age + age = input.readUInt32(); + bitField0_ |= 0x00000020; + tag = input.readTag(); + if (tag != 64) { + break; + } + } + case 64: { + // eyeColor + final int value = input.readInt32(); + if (EyeColor.forNumber(value) != null) { + eyeColor = value; + bitField0_ |= 0x00000040; + } + tag = input.readTag(); + if (tag != 32) { + break; + } + } + case 32: { + // isActive + isActive = input.readBool(); + bitField0_ |= 0x00000080; + tag = input.readTag(); + if (tag != 26) { + break; + } + } + case 26: { + // guid + input.readString(guid); + bitField0_ |= 0x00000100; + tag = input.readTag(); + if (tag != 50) { + break; + } + } + case 50: { + // picture + input.readString(picture); + bitField0_ |= 0x00000200; + tag = input.readTag(); + if (tag != 74) { + break; + } + } + case 74: { + // name + input.readString(name); + bitField0_ |= 0x00000400; + tag = input.readTag(); + if (tag != 82) { + break; + } + } + case 82: { + // gender + input.readString(gender); + bitField0_ |= 0x00000800; + tag = input.readTag(); + if (tag != 90) { + break; + } + } + case 90: { + // company + input.readString(company); + bitField0_ |= 0x00001000; + tag = input.readTag(); + if (tag != 114) { + break; + } + } + case 114: { + // address + input.readString(address); + bitField0_ |= 0x00002000; + tag = input.readTag(); + if (tag != 122) { + break; + } + } + case 122: { + // about + input.readString(about); + bitField0_ |= 0x00004000; + tag = input.readTag(); + if (tag != 130) { + break; + } + } + case 130: { + // registered + input.readString(registered); + bitField0_ |= 0x00008000; + tag = input.readTag(); + if (tag != 106) { + break; + } + } + case 106: { + // phones [packed=true] + input.readPackedFixed64(phones); + bitField0_ |= 0x00010000; + tag = input.readTag(); + if (tag != 162) { + break; + } + } + case 162: { + // partners + tag = input.readRepeatedMessage(partners, tag); + bitField0_ |= 0x00020000; + if (tag != 98) { + break; + } + } + case 98: { + // emails + tag = input.readRepeatedString(emails, tag); + bitField0_ |= 0x00040000; + if (tag != 154) { + break; + } + } + case 154: { + // tags + tag = input.readRepeatedString(tags, tag); + bitField0_ |= 0x00080000; + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + case 105: { + // phones [packed=false] + tag = input.readRepeatedFixed64(phones, tag); + bitField0_ |= 0x00010000; + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeDouble(FieldNames.balance, balance); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeDouble(FieldNames.latitude, latitude); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeDouble(FieldNames.longitude, longitude); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeUInt64(FieldNames.id, id); + } + if ((bitField0_ & 0x00000010) != 0) { + output.writeUInt32(FieldNames.index, index); + } + if ((bitField0_ & 0x00000020) != 0) { + output.writeUInt32(FieldNames.age, age); + } + if ((bitField0_ & 0x00000040) != 0) { + output.writeEnum(FieldNames.eyeColor, eyeColor, EyeColor.converter()); + } + if ((bitField0_ & 0x00000080) != 0) { + output.writeBool(FieldNames.isActive, isActive); + } + if ((bitField0_ & 0x00000100) != 0) { + output.writeString(FieldNames.guid, guid); + } + if ((bitField0_ & 0x00000200) != 0) { + output.writeString(FieldNames.picture, picture); + } + if ((bitField0_ & 0x00000400) != 0) { + output.writeString(FieldNames.name, name); + } + if ((bitField0_ & 0x00000800) != 0) { + output.writeString(FieldNames.gender, gender); + } + if ((bitField0_ & 0x00001000) != 0) { + output.writeString(FieldNames.company, company); + } + if ((bitField0_ & 0x00002000) != 0) { + output.writeString(FieldNames.address, address); + } + if ((bitField0_ & 0x00004000) != 0) { + output.writeString(FieldNames.about, about); + } + if ((bitField0_ & 0x00008000) != 0) { + output.writeString(FieldNames.registered, registered); + } + if ((bitField0_ & 0x00010000) != 0) { + output.writeRepeatedFixed64(FieldNames.phones, phones); + } + if ((bitField0_ & 0x00020000) != 0) { + output.writeRepeatedMessage(FieldNames.partners, partners); + } + if ((bitField0_ & 0x00040000) != 0) { + output.writeRepeatedString(FieldNames.emails, emails); + } + if ((bitField0_ & 0x00080000) != 0) { + output.writeRepeatedString(FieldNames.tags, tags); + } + output.endObject(); + } + + @Override + public Client mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -339185956: { + if (input.isAtField(FieldNames.balance)) { + if (!input.trySkipNullValue()) { + balance = input.readDouble(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1439978388: { + if (input.isAtField(FieldNames.latitude)) { + if (!input.trySkipNullValue()) { + latitude = input.readDouble(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + case 137365935: { + if (input.isAtField(FieldNames.longitude)) { + if (!input.trySkipNullValue()) { + longitude = input.readDouble(); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3355: { + if (input.isAtField(FieldNames.id)) { + if (!input.trySkipNullValue()) { + id = input.readUInt64(); + bitField0_ |= 0x00000008; + } + } else { + input.skipUnknownField(); + } + break; + } + case 100346066: { + if (input.isAtField(FieldNames.index)) { + if (!input.trySkipNullValue()) { + index = input.readUInt32(); + bitField0_ |= 0x00000010; + } + } else { + input.skipUnknownField(); + } + break; + } + case 96511: { + if (input.isAtField(FieldNames.age)) { + if (!input.trySkipNullValue()) { + age = input.readUInt32(); + bitField0_ |= 0x00000020; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1394185294: { + if (input.isAtField(FieldNames.eyeColor)) { + if (!input.trySkipNullValue()) { + final EyeColor value = input.readEnum(EyeColor.converter()); + if (value != null) { + eyeColor = value.getNumber(); + bitField0_ |= 0x00000040; + } else { + input.skipUnknownEnumValue(); + } + } + } else { + input.skipUnknownField(); + } + break; + } + case -748916528: { + if (input.isAtField(FieldNames.isActive)) { + if (!input.trySkipNullValue()) { + isActive = input.readBool(); + bitField0_ |= 0x00000080; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3184265: { + if (input.isAtField(FieldNames.guid)) { + if (!input.trySkipNullValue()) { + input.readString(guid); + bitField0_ |= 0x00000100; + } + } else { + input.skipUnknownField(); + } + break; + } + case -577741570: { + if (input.isAtField(FieldNames.picture)) { + if (!input.trySkipNullValue()) { + input.readString(picture); + bitField0_ |= 0x00000200; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3373707: { + if (input.isAtField(FieldNames.name)) { + if (!input.trySkipNullValue()) { + input.readString(name); + bitField0_ |= 0x00000400; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1249512767: { + if (input.isAtField(FieldNames.gender)) { + if (!input.trySkipNullValue()) { + input.readString(gender); + bitField0_ |= 0x00000800; + } + } else { + input.skipUnknownField(); + } + break; + } + case 950484093: { + if (input.isAtField(FieldNames.company)) { + if (!input.trySkipNullValue()) { + input.readString(company); + bitField0_ |= 0x00001000; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1147692044: { + if (input.isAtField(FieldNames.address)) { + if (!input.trySkipNullValue()) { + input.readString(address); + bitField0_ |= 0x00002000; + } + } else { + input.skipUnknownField(); + } + break; + } + case 92611469: { + if (input.isAtField(FieldNames.about)) { + if (!input.trySkipNullValue()) { + input.readString(about); + bitField0_ |= 0x00004000; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1869930878: { + if (input.isAtField(FieldNames.registered)) { + if (!input.trySkipNullValue()) { + input.readString(registered); + bitField0_ |= 0x00008000; + } + } else { + input.skipUnknownField(); + } + break; + } + case -989040443: { + if (input.isAtField(FieldNames.phones)) { + if (!input.trySkipNullValue()) { + input.readRepeatedFixed64(phones); + bitField0_ |= 0x00010000; + } + } else { + input.skipUnknownField(); + } + break; + } + case 1189002411: { + if (input.isAtField(FieldNames.partners)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(partners); + bitField0_ |= 0x00020000; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1299765161: { + if (input.isAtField(FieldNames.emails)) { + if (!input.trySkipNullValue()) { + input.readRepeatedString(emails); + bitField0_ |= 0x00040000; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3552281: { + if (input.isAtField(FieldNames.tags)) { + if (!input.trySkipNullValue()) { + input.readRepeatedString(tags); + bitField0_ |= 0x00080000; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public Client clone() { + return new Client().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static Client parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new Client(), data).checkInitialized(); + } + + public static Client parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new Client(), input).checkInitialized(); + } + + public static Client parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new Client(), input).checkInitialized(); + } + + /** + * @return factory for creating Client messages + */ + public static MessageFactory getFactory() { + return ClientFactory.INSTANCE; + } + + private enum ClientFactory implements MessageFactory { + INSTANCE; + + @Override + public Client create() { + return Client.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName balance = FieldName.forField("balance"); + + static final FieldName latitude = FieldName.forField("latitude"); + + static final FieldName longitude = FieldName.forField("longitude"); + + static final FieldName id = FieldName.forField("id"); + + static final FieldName index = FieldName.forField("index"); + + static final FieldName age = FieldName.forField("age"); + + static final FieldName eyeColor = FieldName.forField("eyeColor"); + + static final FieldName isActive = FieldName.forField("isActive"); + + static final FieldName guid = FieldName.forField("guid"); + + static final FieldName picture = FieldName.forField("picture"); + + static final FieldName name = FieldName.forField("name"); + + static final FieldName gender = FieldName.forField("gender"); + + static final FieldName company = FieldName.forField("company"); + + static final FieldName address = FieldName.forField("address"); + + static final FieldName about = FieldName.forField("about"); + + static final FieldName registered = FieldName.forField("registered"); + + static final FieldName phones = FieldName.forField("phones"); + + static final FieldName partners = FieldName.forField("partners"); + + static final FieldName emails = FieldName.forField("emails"); + + static final FieldName tags = FieldName.forField("tags"); + } + } + + /** + * Protobuf type {@code Partner} + */ + public static final class Partner extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint64 id = 1; + */ + private long id; + + /** + * optional string name = 2; + */ + private final Utf8String name = Utf8String.newEmptyInstance(); + + /** + *
+             *  OffsetDateTime
+             * 
+ * + * optional string since = 3; + */ + private final Utf8String since = Utf8String.newEmptyInstance(); + + private Partner() { + } + + /** + * @return a new empty instance of {@code Partner} + */ + public static Partner newInstance() { + return new Partner(); + } + + /** + * optional uint64 id = 1; + * @return whether the id field is set + */ + public boolean hasId() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint64 id = 1; + * @return this + */ + public Partner clearId() { + bitField0_ &= ~0x00000001; + id = 0L; + return this; + } + + /** + * optional uint64 id = 1; + * @return the id + */ + public long getId() { + return id; + } + + /** + * optional uint64 id = 1; + * @param value the id to set + * @return this + */ + public Partner setId(final long value) { + bitField0_ |= 0x00000001; + id = value; + return this; + } + + /** + * optional string name = 2; + * @return whether the name field is set + */ + public boolean hasName() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional string name = 2; + * @return this + */ + public Partner clearName() { + bitField0_ &= ~0x00000002; + name.clear(); + return this; + } + + /** + * optional string name = 2; + * @return the name + */ + public String getName() { + return name.getString(); + } + + /** + * optional string name = 2; + * @return internal {@code Utf8String} representation of name for reading + */ + public Utf8String getNameBytes() { + return this.name; + } + + /** + * optional string name = 2; + * @return internal {@code Utf8String} representation of name for modifications + */ + public Utf8String getMutableNameBytes() { + bitField0_ |= 0x00000002; + return this.name; + } + + /** + * optional string name = 2; + * @param value the name to set + * @return this + */ + public Partner setName(final CharSequence value) { + bitField0_ |= 0x00000002; + name.copyFrom(value); + return this; + } + + /** + * optional string name = 2; + * @param value the name to set + * @return this + */ + public Partner setName(final Utf8String value) { + bitField0_ |= 0x00000002; + name.copyFrom(value); + return this; + } + + /** + *
+             *  OffsetDateTime
+             * 
+ * + * optional string since = 3; + * @return whether the since field is set + */ + public boolean hasSince() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + *
+             *  OffsetDateTime
+             * 
+ * + * optional string since = 3; + * @return this + */ + public Partner clearSince() { + bitField0_ &= ~0x00000004; + since.clear(); + return this; + } + + /** + *
+             *  OffsetDateTime
+             * 
+ * + * optional string since = 3; + * @return the since + */ + public String getSince() { + return since.getString(); + } + + /** + *
+             *  OffsetDateTime
+             * 
+ * + * optional string since = 3; + * @return internal {@code Utf8String} representation of since for reading + */ + public Utf8String getSinceBytes() { + return this.since; + } + + /** + *
+             *  OffsetDateTime
+             * 
+ * + * optional string since = 3; + * @return internal {@code Utf8String} representation of since for modifications + */ + public Utf8String getMutableSinceBytes() { + bitField0_ |= 0x00000004; + return this.since; + } + + /** + *
+             *  OffsetDateTime
+             * 
+ * + * optional string since = 3; + * @param value the since to set + * @return this + */ + public Partner setSince(final CharSequence value) { + bitField0_ |= 0x00000004; + since.copyFrom(value); + return this; + } + + /** + *
+             *  OffsetDateTime
+             * 
+ * + * optional string since = 3; + * @param value the since to set + * @return this + */ + public Partner setSince(final Utf8String value) { + bitField0_ |= 0x00000004; + since.copyFrom(value); + return this; + } + + @Override + public Partner copyFrom(final Partner other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + id = other.id; + name.copyFrom(other.name); + since.copyFrom(other.since); + } + return this; + } + + @Override + public Partner mergeFrom(final Partner other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasId()) { + setId(other.id); + } + if (other.hasName()) { + getMutableNameBytes().copyFrom(other.name); + } + if (other.hasSince()) { + getMutableSinceBytes().copyFrom(other.since); + } + return this; + } + + @Override + public Partner clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + id = 0L; + name.clear(); + since.clear(); + return this; + } + + @Override + public Partner clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + name.clear(); + since.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Partner)) { + return false; + } + Partner other = (Partner) o; + return bitField0_ == other.bitField0_ + && (!hasId() || id == other.id) + && (!hasName() || name.equals(other.name)) + && (!hasSince() || since.equals(other.since)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 8); + output.writeUInt64NoTag(id); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 18); + output.writeStringNoTag(name); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 26); + output.writeStringNoTag(since); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt64SizeNoTag(id); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(name); + } + if ((bitField0_ & 0x00000004) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(since); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public Partner mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 8: { + // id + id = input.readUInt64(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 18) { + break; + } + } + case 18: { + // name + input.readString(name); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 26) { + break; + } + } + case 26: { + // since + input.readString(since); + bitField0_ |= 0x00000004; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeUInt64(FieldNames.id, id); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeString(FieldNames.name, name); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeString(FieldNames.since, since); + } + output.endObject(); + } + + @Override + public Partner mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 3355: { + if (input.isAtField(FieldNames.id)) { + if (!input.trySkipNullValue()) { + id = input.readUInt64(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3373707: { + if (input.isAtField(FieldNames.name)) { + if (!input.trySkipNullValue()) { + input.readString(name); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + case 109441850: { + if (input.isAtField(FieldNames.since)) { + if (!input.trySkipNullValue()) { + input.readString(since); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public Partner clone() { + return new Partner().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static Partner parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new Partner(), data).checkInitialized(); + } + + public static Partner parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new Partner(), input).checkInitialized(); + } + + public static Partner parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new Partner(), input).checkInitialized(); + } + + /** + * @return factory for creating Partner messages + */ + public static MessageFactory getFactory() { + return PartnerFactory.INSTANCE; + } + + private enum PartnerFactory implements MessageFactory { + INSTANCE; + + @Override + public Partner create() { + return Partner.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName id = FieldName.forField("id"); + + static final FieldName name = FieldName.forField("name"); + + static final FieldName since = FieldName.forField("since"); + } + } + + private enum ClientsFactory implements MessageFactory { + INSTANCE; + + @Override + public Clients create() { + return Clients.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName clients = FieldName.forField("clients"); + } + } +} diff --git a/src/main/java/com/github/fabienrenaud/jjb/provider/ClientsJsonProvider.java b/src/main/java/com/github/fabienrenaud/jjb/provider/ClientsJsonProvider.java index fec59dd..05f2539 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/provider/ClientsJsonProvider.java +++ b/src/main/java/com/github/fabienrenaud/jjb/provider/ClientsJsonProvider.java @@ -11,6 +11,7 @@ import com.fasterxml.jackson.module.afterburner.AfterburnerModule; import com.fasterxml.jackson.module.blackbird.BlackbirdModule; import com.github.fabienrenaud.jjb.model.Clients; +import com.github.fabienrenaud.jjb.model.quickbuf.QuickbufSchema; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonDeserializer; @@ -37,6 +38,9 @@ import javax.annotation.Nullable; import jakarta.json.bind.Jsonb; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.ProtoMessage; + import java.io.IOException; import java.math.BigDecimal; import java.time.LocalDate; @@ -284,6 +288,22 @@ public QsonMapper qson() { return qson; } + @Override + public ProtoMessage quickbufPojo() { + return QUICKBUF_MESSAGE.get(); + } + + @Override + public JsonSink quickbufSink() { + return QUICKBUF_SINK.get(); + } + + private static final ThreadLocal QUICKBUF_MESSAGE = ThreadLocal.withInitial(QuickbufSchema.Clients::newInstance); + private static final ThreadLocal QUICKBUF_SINK = ThreadLocal.withInitial(() -> JsonSink.newInstance() + .setPrettyPrinting(false) + .setPreserveProtoFieldNames(true) + .setWriteEnumsAsInts(false)); + private static final ThreadLocal FLEXJSON_SER = ThreadLocal.withInitial(() -> new JSONSerializer() .transform(FLEX_IDENTITY, UUID.class) .transform(FLEX_IDENTITY, LocalDate.class) diff --git a/src/main/java/com/github/fabienrenaud/jjb/provider/JsonProvider.java b/src/main/java/com/github/fabienrenaud/jjb/provider/JsonProvider.java index 27dde90..b686574 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/provider/JsonProvider.java +++ b/src/main/java/com/github/fabienrenaud/jjb/provider/JsonProvider.java @@ -11,6 +11,8 @@ import org.apache.johnzon.mapper.Mapper; import jakarta.json.bind.Jsonb; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.ProtoMessage; import java.util.Map; @@ -57,4 +59,9 @@ public interface JsonProvider { io.avaje.jsonb.JsonType avajeJsonb_default(); QsonMapper qson(); + + ProtoMessage quickbufPojo(); + + JsonSink quickbufSink(); + } diff --git a/src/main/java/com/github/fabienrenaud/jjb/provider/UsersJsonProvider.java b/src/main/java/com/github/fabienrenaud/jjb/provider/UsersJsonProvider.java index 9f6cccd..07cb1e6 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/provider/UsersJsonProvider.java +++ b/src/main/java/com/github/fabienrenaud/jjb/provider/UsersJsonProvider.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.module.afterburner.AfterburnerModule; import com.fasterxml.jackson.module.blackbird.BlackbirdModule; import com.github.fabienrenaud.jjb.model.Users; +import com.github.fabienrenaud.jjb.model.quickbuf.QuickbufSchema; import com.google.gson.Gson; import com.owlike.genson.Genson; import com.squareup.moshi.Moshi; @@ -27,6 +28,8 @@ import java.util.Map; import jakarta.json.bind.Jsonb; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.ProtoMessage; public class UsersJsonProvider implements JsonProvider { @@ -179,4 +182,21 @@ public QsonMapper qson() { private static final ThreadLocal JODD_DESER = ThreadLocal.withInitial(jodd.json.JsonParser::new); private static final ThreadLocal JODD_SER = ThreadLocal.withInitial(jodd.json.JsonSerializer::new); + + @Override + public ProtoMessage quickbufPojo() { + return QUICKBUF_MESSAGE.get(); + } + + @Override + public JsonSink quickbufSink() { + return QUICKBUF_SINK.get(); + } + + private static final ThreadLocal QUICKBUF_MESSAGE = ThreadLocal.withInitial(QuickbufSchema.Users::newInstance); + private static final ThreadLocal QUICKBUF_SINK = ThreadLocal.withInitial(() -> JsonSink.newInstance() + .setPrettyPrinting(false) + .setPreserveProtoFieldNames(true) + .setWriteEnumsAsInts(false)); + } diff --git a/src/main/java/com/github/fabienrenaud/jjb/support/BenchSupport.java b/src/main/java/com/github/fabienrenaud/jjb/support/BenchSupport.java index 3f40445..90ae27d 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/support/BenchSupport.java +++ b/src/main/java/com/github/fabienrenaud/jjb/support/BenchSupport.java @@ -36,7 +36,8 @@ public enum BenchSupport { new Libapi(Library.UNDERSCORE_JAVA, Api.STREAM), new Libapi(Library.QSON, Api.DATABIND), new Libapi(Library.PUREJSON, Api.STREAM), - new Libapi(Library.ANTONS, Api.STREAM) + new Libapi(Library.ANTONS, Api.STREAM), + new Libapi(Library.QUICKBUF_JSON, Api.DATABIND) ), CLIENTS( new Libapi(Library.GSON, Api.DATABIND), diff --git a/src/main/java/com/github/fabienrenaud/jjb/support/Library.java b/src/main/java/com/github/fabienrenaud/jjb/support/Library.java index aca8d9b..29405f4 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/support/Library.java +++ b/src/main/java/com/github/fabienrenaud/jjb/support/Library.java @@ -34,7 +34,8 @@ public enum Library { QSON, UNDERSCORE_JAVA, PUREJSON, - ANTONS; + ANTONS, + QUICKBUF_JSON; public static Set fromCsv(String str) { if (str == null || str.trim().isEmpty()) { diff --git a/src/main/proto/quickbuf.proto b/src/main/proto/quickbuf.proto new file mode 100644 index 0000000..8ea134c --- /dev/null +++ b/src/main/proto/quickbuf.proto @@ -0,0 +1,93 @@ +// protobuf schema file that rebuilds the schema using the proto3 json mapping +// https://protobuf.dev/programming-guides/proto3/#json + +syntax = "proto2"; +package quickbuf_unittest; + +// download package from https://github.com/HebiRobotics/QuickBuffers and generate with +// * protoc-quickbuf --quickbuf_out=indent=4:../java/ quickbuf.proto +option java_package = "com.github.fabienrenaud.jjb.model.quickbuf"; +option java_outer_classname = "QuickbufSchema"; +option java_multiple_files = false; + +message Users { + + message User { + + optional string id = 1; + optional uint32 index = 2; + optional string guid = 3; + optional bool isActive = 4; + optional string balance = 5; + optional string picture = 6; + optional uint32 age = 7; + optional string eyeColor = 8; + optional string name = 9; + optional string gender = 10; + optional string company = 11; + optional string email = 12; + optional string phone = 13; + optional string address = 14; + optional string about = 15; + optional string registered = 16; + optional double latitude = 17; + optional double longitude = 18; + + repeated string tags = 19; + + repeated Friend friends = 20; + + optional string greeting = 21; + optional string favoriteFruit = 22; + + } + + message Friend { + required string id = 1; + required string name = 2; + } + + repeated User users = 1; + +} + +message Clients { + + enum EyeColor { + BROWN = 1; + BLUE = 2; + GREEN = 3; + } + + message Client { + optional uint64 id = 1; + optional uint32 index = 2; + optional string guid = 3; // uuid type + optional bool isActive = 4; + optional double balance = 5; // BigDecimal + optional string picture = 6; + optional uint32 age = 7; + optional EyeColor eyeColor = 8; // enum + optional string name = 9; + optional string gender = 10; + optional string company = 11; + repeated string emails = 12; + repeated fixed64 phones = 13; + optional string address = 14; + optional string about = 15; + optional string registered = 16; // LocalDate + optional double latitude = 17; + optional double longitude = 18; + repeated string tags = 19; + repeated Partner partners = 20; + } + + message Partner { + optional uint64 id = 1; + optional string name = 2; + optional string since = 3; // OffsetDateTime + } + + repeated Client clients = 1; + +} \ No newline at end of file diff --git a/src/test/java/com/github/fabienrenaud/jjb/JsonBenchmark.java b/src/test/java/com/github/fabienrenaud/jjb/JsonBenchmark.java index bf2c5d3..2aecd82 100644 --- a/src/test/java/com/github/fabienrenaud/jjb/JsonBenchmark.java +++ b/src/test/java/com/github/fabienrenaud/jjb/JsonBenchmark.java @@ -271,4 +271,12 @@ public void antons() throws Exception { test(Library.ANTONS, BENCH.antons()); } } + + @Test + public void quickbuf_json() throws Exception { + for (int i = 0; i < ITERATIONS; i++) { + test(Library.QUICKBUF_JSON, BENCH.quickbuf_json()); + } + } + }