Skip to content

Auties00/ModernProtobuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ModernProtobuf

A modern implementation of the Protobuf specification for Java 17 and upwards. Both Protobuf 2 and 3 are supported.

What is ModernProtobuf

Protoc, the default compiler for protobuf schemas, can generate Java classes starting from a schema. The generated code, though, is really verbose and not up to date with modern versions of Java. Moreover, it is not really intended to be edited, which is not optimal if you want to have the protobuf to be part of a publicly available developer API. As a result, most projects that work with Google's protobuf create wrappers around the already gigantic classes generated by Google to make them more usable. While developing Cobalt, I faced these issues myself and, as a result, I decided to develop a custom Protobuf implementation: this repo is the result of this work.

How to generate a model

  1. Download the CLI tool from the release tab or compile the project yourself using Maven
  2. Run the following command:
    protoc generate <proto> --output [directory]
    
    This will generate an immutable record. If you want your model to be mutable, add --mutable

How to update a model

  1. Download the CLI tool from the release tab or compile the project yourself using Maven
  2. Run the following command:
    protoc update <proto> <input_directory> --output [directory]
    
    This will update all models in input_directory. If you want your updated models to be mutable, add --mutable

How to encode/decode a message

After you have generated the model, compile your project. Let's say your model is named ScalarMessage, then a class named ScalarMessageSpec will be generated. Now you can easily encode/decode ScalarMessage using ScalarMessageSpec:

ScalarMessage scalarMessage = ...;
var encoded = ScalarMessageSpec.encode(scalarMessage); // Encodes a message as an array of bytes
var decoded = ScalarMessageSpec.decode(encoded); // Decodes a message from an array of bytes

Comparison with Google's implementation

Let's take an example schema to make some considerations on the differences between this library and Google's implementation.

ScalarMessage.proto (15 LOC)
message ScalarMessage {
  optional fixed32 fixed32 = 1;
  optional sfixed32 sfixed32 = 2;
  optional int32 int32 = 3;
  optional uint32 uint32 = 4;
  optional fixed64 fixed64 = 5;
  optional sfixed64 sfixed64 = 6;
  optional int64 int64 = 7;
  optional uint64 uint64 = 8;
  optional float float = 9;
  optional double double = 10;
  optional bool bool = 11;
  optional string string = 12;
  optional bytes bytes = 13;
}

Model generation

ModernProtobuf uses records by default to produce immutable and concise models. If you need your models to be mutable, ModernProtobuf's CLI tool can generate a mutable class just as easily. Google's implementation, on the other hand, produces verbose models that cannot be edited. There is no option to make your data immutable. Here are the models generated by each implementation, alongside how many lines of code were used:

ModernProtobuf immutable java record (28 LOC)
public record ModernScalarMessage(
    @ProtobufProperty(index = 1, type = ProtobufType.FIXED32)
    int fixed32,
    @ProtobufProperty(index = 2, type = ProtobufType.SFIXED32)
    int sfixed32,
    @ProtobufProperty(index = 3, type = ProtobufType.INT32)
    int int32,
    @ProtobufProperty(index = 4, type = ProtobufType.UINT32)
    int uint32,
    @ProtobufProperty(index = 5, type = ProtobufType.FIXED64)
    long fixed64,
    @ProtobufProperty(index = 6, type = ProtobufType.SFIXED64)
    long sfixed64,
    @ProtobufProperty(index = 7, type = ProtobufType.INT64)
    long int64,
    @ProtobufProperty(index = 8, type = ProtobufType.UINT64)
    long uint64,
    @ProtobufProperty(index = 9, type = ProtobufType.FLOAT)
    float _float,
    @ProtobufProperty(index = 10, type = ProtobufType.DOUBLE)
    double _double,
    @ProtobufProperty(index = 11, type = ProtobufType.BOOL)
    boolean bool,
    @ProtobufProperty(index = 12, type = ProtobufType.STRING)
    String string,
    @ProtobufProperty(index = 13, type = ProtobufType.BYTES)
    byte[] bytes
) implements ProtobufMessage { }
Google's Protobuf mutable java class (1832 LOC)
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: scalar.proto

public final class Scalar {
private Scalar() {}
public static void registerAllExtensions(
    com.google.protobuf.ExtensionRegistryLite registry) {
}

public static void registerAllExtensions(
    com.google.protobuf.ExtensionRegistry registry) {
  registerAllExtensions(
      (com.google.protobuf.ExtensionRegistryLite) registry);
}
public interface ScalarMessageOrBuilder extends
    // @@protoc_insertion_point(interface_extends:it.auties.protobuf.ScalarMessage)
    com.google.protobuf.MessageOrBuilder {

  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   * @return Whether the fixed32 field is set.
   */
  boolean hasFixed32();
  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   * @return The fixed32.
   */
  int getFixed32();

  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   * @return Whether the sfixed32 field is set.
   */
  boolean hasSfixed32();
  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   * @return The sfixed32.
   */
  int getSfixed32();

  /**
   * <code>optional int32 int32 = 3;</code>
   * @return Whether the int32 field is set.
   */
  boolean hasInt32();
  /**
   * <code>optional int32 int32 = 3;</code>
   * @return The int32.
   */
  int getInt32();

  /**
   * <code>optional uint32 uint32 = 4;</code>
   * @return Whether the uint32 field is set.
   */
  boolean hasUint32();
  /**
   * <code>optional uint32 uint32 = 4;</code>
   * @return The uint32.
   */
  int getUint32();

  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   * @return Whether the fixed64 field is set.
   */
  boolean hasFixed64();
  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   * @return The fixed64.
   */
  long getFixed64();

  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   * @return Whether the sfixed64 field is set.
   */
  boolean hasSfixed64();
  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   * @return The sfixed64.
   */
  long getSfixed64();

  /**
   * <code>optional int64 int64 = 7;</code>
   * @return Whether the int64 field is set.
   */
  boolean hasInt64();
  /**
   * <code>optional int64 int64 = 7;</code>
   * @return The int64.
   */
  long getInt64();

  /**
   * <code>optional uint64 uint64 = 8;</code>
   * @return Whether the uint64 field is set.
   */
  boolean hasUint64();
  /**
   * <code>optional uint64 uint64 = 8;</code>
   * @return The uint64.
   */
  long getUint64();

  /**
   * <code>optional float float = 9;</code>
   * @return Whether the float field is set.
   */
  boolean hasFloat();
  /**
   * <code>optional float float = 9;</code>
   * @return The float.
   */
  float getFloat();

  /**
   * <code>optional double double = 10;</code>
   * @return Whether the double field is set.
   */
  boolean hasDouble();
  /**
   * <code>optional double double = 10;</code>
   * @return The double.
   */
  double getDouble();

  /**
   * <code>optional bool bool = 11;</code>
   * @return Whether the bool field is set.
   */
  boolean hasBool();
  /**
   * <code>optional bool bool = 11;</code>
   * @return The bool.
   */
  boolean getBool();

  /**
   * <code>optional string string = 12;</code>
   * @return Whether the string field is set.
   */
  boolean hasString();
  /**
   * <code>optional string string = 12;</code>
   * @return The string.
   */
  java.lang.String getString();
  /**
   * <code>optional string string = 12;</code>
   * @return The bytes for string.
   */
  com.google.protobuf.ByteString
      getStringBytes();

  /**
   * <code>optional bytes bytes = 13;</code>
   * @return Whether the bytes field is set.
   */
  boolean hasBytes();
  /**
   * <code>optional bytes bytes = 13;</code>
   * @return The bytes.
   */
  com.google.protobuf.ByteString getBytes();
}
/**
 * Protobuf type {@code it.auties.protobuf.ScalarMessage}
 */
public static final class ScalarMessage extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:it.auties.protobuf.ScalarMessage)
    ScalarMessageOrBuilder {
private static final long serialVersionUID = 0L;
  // Use ScalarMessage.newBuilder() to construct.
  private ScalarMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private ScalarMessage() {
    string_ = "";
    bytes_ = com.google.protobuf.ByteString.EMPTY;
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(
      UnusedPrivateParameter unused) {
    return new ScalarMessage();
  }

  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return it.auties.protobuf.Scalar.internal_static_it_auties_protobuf_ScalarMessage_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return it.auties.protobuf.Scalar.internal_static_it_auties_protobuf_ScalarMessage_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            it.auties.protobuf.Scalar.ScalarMessage.class, it.auties.protobuf.Scalar.ScalarMessage.Builder.class);
  }

  private int bitField0_;
  public static final int FIXED32_FIELD_NUMBER = 1;
  private int fixed32_ = 0;
  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   * @return Whether the fixed32 field is set.
   */
  @java.lang.Override
  public boolean hasFixed32() {
    return ((bitField0_ & 0x00000001) != 0);
  }
  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   * @return The fixed32.
   */
  @java.lang.Override
  public int getFixed32() {
    return fixed32_;
  }

  public static final int SFIXED32_FIELD_NUMBER = 2;
  private int sfixed32_ = 0;
  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   * @return Whether the sfixed32 field is set.
   */
  @java.lang.Override
  public boolean hasSfixed32() {
    return ((bitField0_ & 0x00000002) != 0);
  }
  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   * @return The sfixed32.
   */
  @java.lang.Override
  public int getSfixed32() {
    return sfixed32_;
  }

  public static final int INT32_FIELD_NUMBER = 3;
  private int int32_ = 0;
  /**
   * <code>optional int32 int32 = 3;</code>
   * @return Whether the int32 field is set.
   */
  @java.lang.Override
  public boolean hasInt32() {
    return ((bitField0_ & 0x00000004) != 0);
  }
  /**
   * <code>optional int32 int32 = 3;</code>
   * @return The int32.
   */
  @java.lang.Override
  public int getInt32() {
    return int32_;
  }

  public static final int UINT32_FIELD_NUMBER = 4;
  private int uint32_ = 0;
  /**
   * <code>optional uint32 uint32 = 4;</code>
   * @return Whether the uint32 field is set.
   */
  @java.lang.Override
  public boolean hasUint32() {
    return ((bitField0_ & 0x00000008) != 0);
  }
  /**
   * <code>optional uint32 uint32 = 4;</code>
   * @return The uint32.
   */
  @java.lang.Override
  public int getUint32() {
    return uint32_;
  }

  public static final int FIXED64_FIELD_NUMBER = 5;
  private long fixed64_ = 0L;
  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   * @return Whether the fixed64 field is set.
   */
  @java.lang.Override
  public boolean hasFixed64() {
    return ((bitField0_ & 0x00000010) != 0);
  }
  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   * @return The fixed64.
   */
  @java.lang.Override
  public long getFixed64() {
    return fixed64_;
  }

  public static final int SFIXED64_FIELD_NUMBER = 6;
  private long sfixed64_ = 0L;
  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   * @return Whether the sfixed64 field is set.
   */
  @java.lang.Override
  public boolean hasSfixed64() {
    return ((bitField0_ & 0x00000020) != 0);
  }
  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   * @return The sfixed64.
   */
  @java.lang.Override
  public long getSfixed64() {
    return sfixed64_;
  }

  public static final int INT64_FIELD_NUMBER = 7;
  private long int64_ = 0L;
  /**
   * <code>optional int64 int64 = 7;</code>
   * @return Whether the int64 field is set.
   */
  @java.lang.Override
  public boolean hasInt64() {
    return ((bitField0_ & 0x00000040) != 0);
  }
  /**
   * <code>optional int64 int64 = 7;</code>
   * @return The int64.
   */
  @java.lang.Override
  public long getInt64() {
    return int64_;
  }

  public static final int UINT64_FIELD_NUMBER = 8;
  private long uint64_ = 0L;
  /**
   * <code>optional uint64 uint64 = 8;</code>
   * @return Whether the uint64 field is set.
   */
  @java.lang.Override
  public boolean hasUint64() {
    return ((bitField0_ & 0x00000080) != 0);
  }
  /**
   * <code>optional uint64 uint64 = 8;</code>
   * @return The uint64.
   */
  @java.lang.Override
  public long getUint64() {
    return uint64_;
  }

  public static final int FLOAT_FIELD_NUMBER = 9;
  private float float_ = 0F;
  /**
   * <code>optional float float = 9;</code>
   * @return Whether the float field is set.
   */
  @java.lang.Override
  public boolean hasFloat() {
    return ((bitField0_ & 0x00000100) != 0);
  }
  /**
   * <code>optional float float = 9;</code>
   * @return The float.
   */
  @java.lang.Override
  public float getFloat() {
    return float_;
  }

  public static final int DOUBLE_FIELD_NUMBER = 10;
  private double double_ = 0D;
  /**
   * <code>optional double double = 10;</code>
   * @return Whether the double field is set.
   */
  @java.lang.Override
  public boolean hasDouble() {
    return ((bitField0_ & 0x00000200) != 0);
  }
  /**
   * <code>optional double double = 10;</code>
   * @return The double.
   */
  @java.lang.Override
  public double getDouble() {
    return double_;
  }

  public static final int BOOL_FIELD_NUMBER = 11;
  private boolean bool_ = false;
  /**
   * <code>optional bool bool = 11;</code>
   * @return Whether the bool field is set.
   */
  @java.lang.Override
  public boolean hasBool() {
    return ((bitField0_ & 0x00000400) != 0);
  }
  /**
   * <code>optional bool bool = 11;</code>
   * @return The bool.
   */
  @java.lang.Override
  public boolean getBool() {
    return bool_;
  }

  public static final int STRING_FIELD_NUMBER = 12;
  @SuppressWarnings("serial")
  private volatile java.lang.Object string_ = "";
  /**
   * <code>optional string string = 12;</code>
   * @return Whether the string field is set.
   */
  @java.lang.Override
  public boolean hasString() {
    return ((bitField0_ & 0x00000800) != 0);
  }
  /**
   * <code>optional string string = 12;</code>
   * @return The string.
   */
  @java.lang.Override
  public java.lang.String getString() {
    java.lang.Object ref = string_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        string_ = s;
      }
      return s;
    }
  }
  /**
   * <code>optional string string = 12;</code>
   * @return The bytes for string.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getStringBytes() {
    java.lang.Object ref = string_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      string_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int BYTES_FIELD_NUMBER = 13;
  private com.google.protobuf.ByteString bytes_ = com.google.protobuf.ByteString.EMPTY;
  /**
   * <code>optional bytes bytes = 13;</code>
   * @return Whether the bytes field is set.
   */
  @java.lang.Override
  public boolean hasBytes() {
    return ((bitField0_ & 0x00001000) != 0);
  }
  /**
   * <code>optional bytes bytes = 13;</code>
   * @return The bytes.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getBytes() {
    return bytes_;
  }

  private byte memoizedIsInitialized = -1;
  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeFixed32(1, fixed32_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      output.writeSFixed32(2, sfixed32_);
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      output.writeInt32(3, int32_);
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      output.writeUInt32(4, uint32_);
    }
    if (((bitField0_ & 0x00000010) != 0)) {
      output.writeFixed64(5, fixed64_);
    }
    if (((bitField0_ & 0x00000020) != 0)) {
      output.writeSFixed64(6, sfixed64_);
    }
    if (((bitField0_ & 0x00000040) != 0)) {
      output.writeInt64(7, int64_);
    }
    if (((bitField0_ & 0x00000080) != 0)) {
      output.writeUInt64(8, uint64_);
    }
    if (((bitField0_ & 0x00000100) != 0)) {
      output.writeFloat(9, float_);
    }
    if (((bitField0_ & 0x00000200) != 0)) {
      output.writeDouble(10, double_);
    }
    if (((bitField0_ & 0x00000400) != 0)) {
      output.writeBool(11, bool_);
    }
    if (((bitField0_ & 0x00000800) != 0)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 12, string_);
    }
    if (((bitField0_ & 0x00001000) != 0)) {
      output.writeBytes(13, bytes_);
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeFixed32Size(1, fixed32_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeSFixed32Size(2, sfixed32_);
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt32Size(3, int32_);
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeUInt32Size(4, uint32_);
    }
    if (((bitField0_ & 0x00000010) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeFixed64Size(5, fixed64_);
    }
    if (((bitField0_ & 0x00000020) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeSFixed64Size(6, sfixed64_);
    }
    if (((bitField0_ & 0x00000040) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt64Size(7, int64_);
    }
    if (((bitField0_ & 0x00000080) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeUInt64Size(8, uint64_);
    }
    if (((bitField0_ & 0x00000100) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeFloatSize(9, float_);
    }
    if (((bitField0_ & 0x00000200) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeDoubleSize(10, double_);
    }
    if (((bitField0_ & 0x00000400) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeBoolSize(11, bool_);
    }
    if (((bitField0_ & 0x00000800) != 0)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, string_);
    }
    if (((bitField0_ & 0x00001000) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(13, bytes_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof it.auties.protobuf.Scalar.ScalarMessage)) {
      return super.equals(obj);
    }
    it.auties.protobuf.Scalar.ScalarMessage other = (it.auties.protobuf.Scalar.ScalarMessage) obj;

    if (hasFixed32() != other.hasFixed32()) return false;
    if (hasFixed32()) {
      if (getFixed32()
          != other.getFixed32()) return false;
    }
    if (hasSfixed32() != other.hasSfixed32()) return false;
    if (hasSfixed32()) {
      if (getSfixed32()
          != other.getSfixed32()) return false;
    }
    if (hasInt32() != other.hasInt32()) return false;
    if (hasInt32()) {
      if (getInt32()
          != other.getInt32()) return false;
    }
    if (hasUint32() != other.hasUint32()) return false;
    if (hasUint32()) {
      if (getUint32()
          != other.getUint32()) return false;
    }
    if (hasFixed64() != other.hasFixed64()) return false;
    if (hasFixed64()) {
      if (getFixed64()
          != other.getFixed64()) return false;
    }
    if (hasSfixed64() != other.hasSfixed64()) return false;
    if (hasSfixed64()) {
      if (getSfixed64()
          != other.getSfixed64()) return false;
    }
    if (hasInt64() != other.hasInt64()) return false;
    if (hasInt64()) {
      if (getInt64()
          != other.getInt64()) return false;
    }
    if (hasUint64() != other.hasUint64()) return false;
    if (hasUint64()) {
      if (getUint64()
          != other.getUint64()) return false;
    }
    if (hasFloat() != other.hasFloat()) return false;
    if (hasFloat()) {
      if (java.lang.Float.floatToIntBits(getFloat())
          != java.lang.Float.floatToIntBits(
              other.getFloat())) return false;
    }
    if (hasDouble() != other.hasDouble()) return false;
    if (hasDouble()) {
      if (java.lang.Double.doubleToLongBits(getDouble())
          != java.lang.Double.doubleToLongBits(
              other.getDouble())) return false;
    }
    if (hasBool() != other.hasBool()) return false;
    if (hasBool()) {
      if (getBool()
          != other.getBool()) return false;
    }
    if (hasString() != other.hasString()) return false;
    if (hasString()) {
      if (!getString()
          .equals(other.getString())) return false;
    }
    if (hasBytes() != other.hasBytes()) return false;
    if (hasBytes()) {
      if (!getBytes()
          .equals(other.getBytes())) return false;
    }
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasFixed32()) {
      hash = (37 * hash) + FIXED32_FIELD_NUMBER;
      hash = (53 * hash) + getFixed32();
    }
    if (hasSfixed32()) {
      hash = (37 * hash) + SFIXED32_FIELD_NUMBER;
      hash = (53 * hash) + getSfixed32();
    }
    if (hasInt32()) {
      hash = (37 * hash) + INT32_FIELD_NUMBER;
      hash = (53 * hash) + getInt32();
    }
    if (hasUint32()) {
      hash = (37 * hash) + UINT32_FIELD_NUMBER;
      hash = (53 * hash) + getUint32();
    }
    if (hasFixed64()) {
      hash = (37 * hash) + FIXED64_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
          getFixed64());
    }
    if (hasSfixed64()) {
      hash = (37 * hash) + SFIXED64_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
          getSfixed64());
    }
    if (hasInt64()) {
      hash = (37 * hash) + INT64_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
          getInt64());
    }
    if (hasUint64()) {
      hash = (37 * hash) + UINT64_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
          getUint64());
    }
    if (hasFloat()) {
      hash = (37 * hash) + FLOAT_FIELD_NUMBER;
      hash = (53 * hash) + java.lang.Float.floatToIntBits(
          getFloat());
    }
    if (hasDouble()) {
      hash = (37 * hash) + DOUBLE_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
          java.lang.Double.doubleToLongBits(getDouble()));
    }
    if (hasBool()) {
      hash = (37 * hash) + BOOL_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
          getBool());
    }
    if (hasString()) {
      hash = (37 * hash) + STRING_FIELD_NUMBER;
      hash = (53 * hash) + getString().hashCode();
    }
    if (hasBytes()) {
      hash = (37 * hash) + BYTES_FIELD_NUMBER;
      hash = (53 * hash) + getBytes().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public static it.auties.protobuf.Scalar.ScalarMessage parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }

  public static it.auties.protobuf.Scalar.ScalarMessage parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(it.auties.protobuf.Scalar.ScalarMessage prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * Protobuf type {@code it.auties.protobuf.ScalarMessage}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:it.auties.protobuf.ScalarMessage)
      it.auties.protobuf.Scalar.ScalarMessageOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return it.auties.protobuf.Scalar.internal_static_it_auties_protobuf_ScalarMessage_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return it.auties.protobuf.Scalar.internal_static_it_auties_protobuf_ScalarMessage_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              it.auties.protobuf.Scalar.ScalarMessage.class, it.auties.protobuf.Scalar.ScalarMessage.Builder.class);
    }

    // Construct using it.auties.protobuf.Scalar.ScalarMessage.newBuilder()
    private Builder() {

    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);

    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      fixed32_ = 0;
      sfixed32_ = 0;
      int32_ = 0;
      uint32_ = 0;
      fixed64_ = 0L;
      sfixed64_ = 0L;
      int64_ = 0L;
      uint64_ = 0L;
      float_ = 0F;
      double_ = 0D;
      bool_ = false;
      string_ = "";
      bytes_ = com.google.protobuf.ByteString.EMPTY;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return it.auties.protobuf.Scalar.internal_static_it_auties_protobuf_ScalarMessage_descriptor;
    }

    @java.lang.Override
    public it.auties.protobuf.Scalar.ScalarMessage getDefaultInstanceForType() {
      return it.auties.protobuf.Scalar.ScalarMessage.getDefaultInstance();
    }

    @java.lang.Override
    public it.auties.protobuf.Scalar.ScalarMessage build() {
      it.auties.protobuf.Scalar.ScalarMessage result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public it.auties.protobuf.Scalar.ScalarMessage buildPartial() {
      it.auties.protobuf.Scalar.ScalarMessage result = new it.auties.protobuf.Scalar.ScalarMessage(this);
      if (bitField0_ != 0) { buildPartial0(result); }
      onBuilt();
      return result;
    }

    private void buildPartial0(it.auties.protobuf.Scalar.ScalarMessage result) {
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.fixed32_ = fixed32_;
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.sfixed32_ = sfixed32_;
        to_bitField0_ |= 0x00000002;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.int32_ = int32_;
        to_bitField0_ |= 0x00000004;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.uint32_ = uint32_;
        to_bitField0_ |= 0x00000008;
      }
      if (((from_bitField0_ & 0x00000010) != 0)) {
        result.fixed64_ = fixed64_;
        to_bitField0_ |= 0x00000010;
      }
      if (((from_bitField0_ & 0x00000020) != 0)) {
        result.sfixed64_ = sfixed64_;
        to_bitField0_ |= 0x00000020;
      }
      if (((from_bitField0_ & 0x00000040) != 0)) {
        result.int64_ = int64_;
        to_bitField0_ |= 0x00000040;
      }
      if (((from_bitField0_ & 0x00000080) != 0)) {
        result.uint64_ = uint64_;
        to_bitField0_ |= 0x00000080;
      }
      if (((from_bitField0_ & 0x00000100) != 0)) {
        result.float_ = float_;
        to_bitField0_ |= 0x00000100;
      }
      if (((from_bitField0_ & 0x00000200) != 0)) {
        result.double_ = double_;
        to_bitField0_ |= 0x00000200;
      }
      if (((from_bitField0_ & 0x00000400) != 0)) {
        result.bool_ = bool_;
        to_bitField0_ |= 0x00000400;
      }
      if (((from_bitField0_ & 0x00000800) != 0)) {
        result.string_ = string_;
        to_bitField0_ |= 0x00000800;
      }
      if (((from_bitField0_ & 0x00001000) != 0)) {
        result.bytes_ = bytes_;
        to_bitField0_ |= 0x00001000;
      }
      result.bitField0_ |= to_bitField0_;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }
    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.setField(field, value);
    }
    @java.lang.Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }
    @java.lang.Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }
    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }
    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }
    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof it.auties.protobuf.Scalar.ScalarMessage) {
        return mergeFrom((it.auties.protobuf.Scalar.ScalarMessage)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(it.auties.protobuf.Scalar.ScalarMessage other) {
      if (other == it.auties.protobuf.Scalar.ScalarMessage.getDefaultInstance()) return this;
      if (other.hasFixed32()) {
        setFixed32(other.getFixed32());
      }
      if (other.hasSfixed32()) {
        setSfixed32(other.getSfixed32());
      }
      if (other.hasInt32()) {
        setInt32(other.getInt32());
      }
      if (other.hasUint32()) {
        setUint32(other.getUint32());
      }
      if (other.hasFixed64()) {
        setFixed64(other.getFixed64());
      }
      if (other.hasSfixed64()) {
        setSfixed64(other.getSfixed64());
      }
      if (other.hasInt64()) {
        setInt64(other.getInt64());
      }
      if (other.hasUint64()) {
        setUint64(other.getUint64());
      }
      if (other.hasFloat()) {
        setFloat(other.getFloat());
      }
      if (other.hasDouble()) {
        setDouble(other.getDouble());
      }
      if (other.hasBool()) {
        setBool(other.getBool());
      }
      if (other.hasString()) {
        string_ = other.string_;
        bitField0_ |= 0x00000800;
        onChanged();
      }
      if (other.hasBytes()) {
        setBytes(other.getBytes());
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 13: {
              fixed32_ = input.readFixed32();
              bitField0_ |= 0x00000001;
              break;
            } // case 13
            case 21: {
              sfixed32_ = input.readSFixed32();
              bitField0_ |= 0x00000002;
              break;
            } // case 21
            case 24: {
              int32_ = input.readInt32();
              bitField0_ |= 0x00000004;
              break;
            } // case 24
            case 32: {
              uint32_ = input.readUInt32();
              bitField0_ |= 0x00000008;
              break;
            } // case 32
            case 41: {
              fixed64_ = input.readFixed64();
              bitField0_ |= 0x00000010;
              break;
            } // case 41
            case 49: {
              sfixed64_ = input.readSFixed64();
              bitField0_ |= 0x00000020;
              break;
            } // case 49
            case 56: {
              int64_ = input.readInt64();
              bitField0_ |= 0x00000040;
              break;
            } // case 56
            case 64: {
              uint64_ = input.readUInt64();
              bitField0_ |= 0x00000080;
              break;
            } // case 64
            case 77: {
              float_ = input.readFloat();
              bitField0_ |= 0x00000100;
              break;
            } // case 77
            case 81: {
              double_ = input.readDouble();
              bitField0_ |= 0x00000200;
              break;
            } // case 81
            case 88: {
              bool_ = input.readBool();
              bitField0_ |= 0x00000400;
              break;
            } // case 88
            case 98: {
              string_ = input.readBytes();
              bitField0_ |= 0x00000800;
              break;
            } // case 98
            case 106: {
              bytes_ = input.readBytes();
              bitField0_ |= 0x00001000;
              break;
            } // case 106
            default: {
              if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                done = true; // was an endgroup tag
              }
              break;
            } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }
    private int bitField0_;

    private int fixed32_ ;
    /**
     * <code>optional fixed32 fixed32 = 1;</code>
     * @return Whether the fixed32 field is set.
     */
    @java.lang.Override
    public boolean hasFixed32() {
      return ((bitField0_ & 0x00000001) != 0);
    }
    /**
     * <code>optional fixed32 fixed32 = 1;</code>
     * @return The fixed32.
     */
    @java.lang.Override
    public int getFixed32() {
      return fixed32_;
    }
    /**
     * <code>optional fixed32 fixed32 = 1;</code>
     * @param value The fixed32 to set.
     * @return This builder for chaining.
     */
    public Builder setFixed32(int value) {

      fixed32_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     * <code>optional fixed32 fixed32 = 1;</code>
     * @return This builder for chaining.
     */
    public Builder clearFixed32() {
      bitField0_ = (bitField0_ & ~0x00000001);
      fixed32_ = 0;
      onChanged();
      return this;
    }

    private int sfixed32_ ;
    /**
     * <code>optional sfixed32 sfixed32 = 2;</code>
     * @return Whether the sfixed32 field is set.
     */
    @java.lang.Override
    public boolean hasSfixed32() {
      return ((bitField0_ & 0x00000002) != 0);
    }
    /**
     * <code>optional sfixed32 sfixed32 = 2;</code>
     * @return The sfixed32.
     */
    @java.lang.Override
    public int getSfixed32() {
      return sfixed32_;
    }
    /**
     * <code>optional sfixed32 sfixed32 = 2;</code>
     * @param value The sfixed32 to set.
     * @return This builder for chaining.
     */
    public Builder setSfixed32(int value) {

      sfixed32_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     * <code>optional sfixed32 sfixed32 = 2;</code>
     * @return This builder for chaining.
     */
    public Builder clearSfixed32() {
      bitField0_ = (bitField0_ & ~0x00000002);
      sfixed32_ = 0;
      onChanged();
      return this;
    }

    private int int32_ ;
    /**
     * <code>optional int32 int32 = 3;</code>
     * @return Whether the int32 field is set.
     */
    @java.lang.Override
    public boolean hasInt32() {
      return ((bitField0_ & 0x00000004) != 0);
    }
    /**
     * <code>optional int32 int32 = 3;</code>
     * @return The int32.
     */
    @java.lang.Override
    public int getInt32() {
      return int32_;
    }
    /**
     * <code>optional int32 int32 = 3;</code>
     * @param value The int32 to set.
     * @return This builder for chaining.
     */
    public Builder setInt32(int value) {

      int32_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     * <code>optional int32 int32 = 3;</code>
     * @return This builder for chaining.
     */
    public Builder clearInt32() {
      bitField0_ = (bitField0_ & ~0x00000004);
      int32_ = 0;
      onChanged();
      return this;
    }

    private int uint32_ ;
    /**
     * <code>optional uint32 uint32 = 4;</code>
     * @return Whether the uint32 field is set.
     */
    @java.lang.Override
    public boolean hasUint32() {
      return ((bitField0_ & 0x00000008) != 0);
    }
    /**
     * <code>optional uint32 uint32 = 4;</code>
     * @return The uint32.
     */
    @java.lang.Override
    public int getUint32() {
      return uint32_;
    }
    /**
     * <code>optional uint32 uint32 = 4;</code>
     * @param value The uint32 to set.
     * @return This builder for chaining.
     */
    public Builder setUint32(int value) {

      uint32_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     * <code>optional uint32 uint32 = 4;</code>
     * @return This builder for chaining.
     */
    public Builder clearUint32() {
      bitField0_ = (bitField0_ & ~0x00000008);
      uint32_ = 0;
      onChanged();
      return this;
    }

    private long fixed64_ ;
    /**
     * <code>optional fixed64 fixed64 = 5;</code>
     * @return Whether the fixed64 field is set.
     */
    @java.lang.Override
    public boolean hasFixed64() {
      return ((bitField0_ & 0x00000010) != 0);
    }
    /**
     * <code>optional fixed64 fixed64 = 5;</code>
     * @return The fixed64.
     */
    @java.lang.Override
    public long getFixed64() {
      return fixed64_;
    }
    /**
     * <code>optional fixed64 fixed64 = 5;</code>
     * @param value The fixed64 to set.
     * @return This builder for chaining.
     */
    public Builder setFixed64(long value) {

      fixed64_ = value;
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     * <code>optional fixed64 fixed64 = 5;</code>
     * @return This builder for chaining.
     */
    public Builder clearFixed64() {
      bitField0_ = (bitField0_ & ~0x00000010);
      fixed64_ = 0L;
      onChanged();
      return this;
    }

    private long sfixed64_ ;
    /**
     * <code>optional sfixed64 sfixed64 = 6;</code>
     * @return Whether the sfixed64 field is set.
     */
    @java.lang.Override
    public boolean hasSfixed64() {
      return ((bitField0_ & 0x00000020) != 0);
    }
    /**
     * <code>optional sfixed64 sfixed64 = 6;</code>
     * @return The sfixed64.
     */
    @java.lang.Override
    public long getSfixed64() {
      return sfixed64_;
    }
    /**
     * <code>optional sfixed64 sfixed64 = 6;</code>
     * @param value The sfixed64 to set.
     * @return This builder for chaining.
     */
    public Builder setSfixed64(long value) {

      sfixed64_ = value;
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     * <code>optional sfixed64 sfixed64 = 6;</code>
     * @return This builder for chaining.
     */
    public Builder clearSfixed64() {
      bitField0_ = (bitField0_ & ~0x00000020);
      sfixed64_ = 0L;
      onChanged();
      return this;
    }

    private long int64_ ;
    /**
     * <code>optional int64 int64 = 7;</code>
     * @return Whether the int64 field is set.
     */
    @java.lang.Override
    public boolean hasInt64() {
      return ((bitField0_ & 0x00000040) != 0);
    }
    /**
     * <code>optional int64 int64 = 7;</code>
     * @return The int64.
     */
    @java.lang.Override
    public long getInt64() {
      return int64_;
    }
    /**
     * <code>optional int64 int64 = 7;</code>
     * @param value The int64 to set.
     * @return This builder for chaining.
     */
    public Builder setInt64(long value) {

      int64_ = value;
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }
    /**
     * <code>optional int64 int64 = 7;</code>
     * @return This builder for chaining.
     */
    public Builder clearInt64() {
      bitField0_ = (bitField0_ & ~0x00000040);
      int64_ = 0L;
      onChanged();
      return this;
    }

    private long uint64_ ;
    /**
     * <code>optional uint64 uint64 = 8;</code>
     * @return Whether the uint64 field is set.
     */
    @java.lang.Override
    public boolean hasUint64() {
      return ((bitField0_ & 0x00000080) != 0);
    }
    /**
     * <code>optional uint64 uint64 = 8;</code>
     * @return The uint64.
     */
    @java.lang.Override
    public long getUint64() {
      return uint64_;
    }
    /**
     * <code>optional uint64 uint64 = 8;</code>
     * @param value The uint64 to set.
     * @return This builder for chaining.
     */
    public Builder setUint64(long value) {

      uint64_ = value;
      bitField0_ |= 0x00000080;
      onChanged();
      return this;
    }
    /**
     * <code>optional uint64 uint64 = 8;</code>
     * @return This builder for chaining.
     */
    public Builder clearUint64() {
      bitField0_ = (bitField0_ & ~0x00000080);
      uint64_ = 0L;
      onChanged();
      return this;
    }

    private float float_ ;
    /**
     * <code>optional float float = 9;</code>
     * @return Whether the float field is set.
     */
    @java.lang.Override
    public boolean hasFloat() {
      return ((bitField0_ & 0x00000100) != 0);
    }
    /**
     * <code>optional float float = 9;</code>
     * @return The float.
     */
    @java.lang.Override
    public float getFloat() {
      return float_;
    }
    /**
     * <code>optional float float = 9;</code>
     * @param value The float to set.
     * @return This builder for chaining.
     */
    public Builder setFloat(float value) {

      float_ = value;
      bitField0_ |= 0x00000100;
      onChanged();
      return this;
    }
    /**
     * <code>optional float float = 9;</code>
     * @return This builder for chaining.
     */
    public Builder clearFloat() {
      bitField0_ = (bitField0_ & ~0x00000100);
      float_ = 0F;
      onChanged();
      return this;
    }

    private double double_ ;
    /**
     * <code>optional double double = 10;</code>
     * @return Whether the double field is set.
     */
    @java.lang.Override
    public boolean hasDouble() {
      return ((bitField0_ & 0x00000200) != 0);
    }
    /**
     * <code>optional double double = 10;</code>
     * @return The double.
     */
    @java.lang.Override
    public double getDouble() {
      return double_;
    }
    /**
     * <code>optional double double = 10;</code>
     * @param value The double to set.
     * @return This builder for chaining.
     */
    public Builder setDouble(double value) {

      double_ = value;
      bitField0_ |= 0x00000200;
      onChanged();
      return this;
    }
    /**
     * <code>optional double double = 10;</code>
     * @return This builder for chaining.
     */
    public Builder clearDouble() {
      bitField0_ = (bitField0_ & ~0x00000200);
      double_ = 0D;
      onChanged();
      return this;
    }

    private boolean bool_ ;
    /**
     * <code>optional bool bool = 11;</code>
     * @return Whether the bool field is set.
     */
    @java.lang.Override
    public boolean hasBool() {
      return ((bitField0_ & 0x00000400) != 0);
    }
    /**
     * <code>optional bool bool = 11;</code>
     * @return The bool.
     */
    @java.lang.Override
    public boolean getBool() {
      return bool_;
    }
    /**
     * <code>optional bool bool = 11;</code>
     * @param value The bool to set.
     * @return This builder for chaining.
     */
    public Builder setBool(boolean value) {

      bool_ = value;
      bitField0_ |= 0x00000400;
      onChanged();
      return this;
    }
    /**
     * <code>optional bool bool = 11;</code>
     * @return This builder for chaining.
     */
    public Builder clearBool() {
      bitField0_ = (bitField0_ & ~0x00000400);
      bool_ = false;
      onChanged();
      return this;
    }

    private java.lang.Object string_ = "";
    /**
     * <code>optional string string = 12;</code>
     * @return Whether the string field is set.
     */
    public boolean hasString() {
      return ((bitField0_ & 0x00000800) != 0);
    }
    /**
     * <code>optional string string = 12;</code>
     * @return The string.
     */
    public java.lang.String getString() {
      java.lang.Object ref = string_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          string_ = s;
        }
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <code>optional string string = 12;</code>
     * @return The bytes for string.
     */
    public com.google.protobuf.ByteString
        getStringBytes() {
      java.lang.Object ref = string_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        string_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <code>optional string string = 12;</code>
     * @param value The string to set.
     * @return This builder for chaining.
     */
    public Builder setString(
        java.lang.String value) {
      if (value == null) { throw new NullPointerException(); }
      string_ = value;
      bitField0_ |= 0x00000800;
      onChanged();
      return this;
    }
    /**
     * <code>optional string string = 12;</code>
     * @return This builder for chaining.
     */
    public Builder clearString() {
      string_ = getDefaultInstance().getString();
      bitField0_ = (bitField0_ & ~0x00000800);
      onChanged();
      return this;
    }
    /**
     * <code>optional string string = 12;</code>
     * @param value The bytes for string to set.
     * @return This builder for chaining.
     */
    public Builder setStringBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) { throw new NullPointerException(); }
      string_ = value;
      bitField0_ |= 0x00000800;
      onChanged();
      return this;
    }

    private com.google.protobuf.ByteString bytes_ = com.google.protobuf.ByteString.EMPTY;
    /**
     * <code>optional bytes bytes = 13;</code>
     * @return Whether the bytes field is set.
     */
    @java.lang.Override
    public boolean hasBytes() {
      return ((bitField0_ & 0x00001000) != 0);
    }
    /**
     * <code>optional bytes bytes = 13;</code>
     * @return The bytes.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getBytes() {
      return bytes_;
    }
    /**
     * <code>optional bytes bytes = 13;</code>
     * @param value The bytes to set.
     * @return This builder for chaining.
     */
    public Builder setBytes(com.google.protobuf.ByteString value) {
      if (value == null) { throw new NullPointerException(); }
      bytes_ = value;
      bitField0_ |= 0x00001000;
      onChanged();
      return this;
    }
    /**
     * <code>optional bytes bytes = 13;</code>
     * @return This builder for chaining.
     */
    public Builder clearBytes() {
      bitField0_ = (bitField0_ & ~0x00001000);
      bytes_ = getDefaultInstance().getBytes();
      onChanged();
      return this;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:it.auties.protobuf.ScalarMessage)
  }

  // @@protoc_insertion_point(class_scope:it.auties.protobuf.ScalarMessage)
  private static final it.auties.protobuf.Scalar.ScalarMessage DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new it.auties.protobuf.Scalar.ScalarMessage();
  }

  public static it.auties.protobuf.Scalar.ScalarMessage getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  @java.lang.Deprecated public static final com.google.protobuf.Parser<ScalarMessage>
      PARSER = new com.google.protobuf.AbstractParser<ScalarMessage>() {
    @java.lang.Override
    public ScalarMessage parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      Builder builder = newBuilder();
      try {
        builder.mergeFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(builder.buildPartial());
      } catch (com.google.protobuf.UninitializedMessageException e) {
        throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(e)
            .setUnfinishedMessage(builder.buildPartial());
      }
      return builder.buildPartial();
    }
  };

  public static com.google.protobuf.Parser<ScalarMessage> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<ScalarMessage> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public it.auties.protobuf.Scalar.ScalarMessage getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

private static final com.google.protobuf.Descriptors.Descriptor
  internal_static_it_auties_protobuf_ScalarMessage_descriptor;
private static final 
  com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
    internal_static_it_auties_protobuf_ScalarMessage_fieldAccessorTable;

public static com.google.protobuf.Descriptors.FileDescriptor
    getDescriptor() {
  return descriptor;
}
private static  com.google.protobuf.Descriptors.FileDescriptor
    descriptor;
static {
  java.lang.String[] descriptorData = {
    "\n\014scalar.proto\022\022it.auties.protobuf\"\337\001\n\rS" +
    "calarMessage\022\017\n\007fixed32\030\001 \001(\007\022\020\n\010sfixed3" +
    "2\030\002 \001(\017\022\r\n\005int32\030\003 \001(\005\022\016\n\006uint32\030\004 \001(\r\022\017" +
    "\n\007fixed64\030\005 \001(\006\022\020\n\010sfixed64\030\006 \001(\020\022\r\n\005int" +
    "64\030\007 \001(\003\022\016\n\006uint64\030\010 \001(\004\022\r\n\005float\030\t \001(\002\022" +
    "\016\n\006double\030\n \001(\001\022\014\n\004bool\030\013 \001(\010\022\016\n\006string\030" +
    "\014 \001(\t\022\r\n\005bytes\030\r \001(\014"
  };
  descriptor = com.google.protobuf.Descriptors.FileDescriptor
    .internalBuildGeneratedFileFrom(descriptorData,
      new com.google.protobuf.Descriptors.FileDescriptor[] {
      });
  internal_static_it_auties_protobuf_ScalarMessage_descriptor =
    getDescriptor().getMessageTypes().get(0);
  internal_static_it_auties_protobuf_ScalarMessage_fieldAccessorTable = new
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
      internal_static_it_auties_protobuf_ScalarMessage_descriptor,
      new java.lang.String[] { "Fixed32", "Sfixed32", "Int32", "Uint32", "Fixed64", "Sfixed64", "Int64", "Uint64", "Float", "Double", "Bool", "String", "Bytes", });
}

// @@protoc_insertion_point(outer_class_scope)
}
Google's Lite Protobuf mutable java class (1318 LOC)
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: scalar.proto

public final class Scalar {
private Scalar() {}
public static void registerAllExtensions(
    com.google.protobuf.ExtensionRegistryLite registry) {
}
public interface ScalarMessageOrBuilder extends
    // @@protoc_insertion_point(interface_extends:it.auties.protobuf.ScalarMessage)
    com.google.protobuf.MessageLiteOrBuilder {

  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   * @return Whether the fixed32 field is set.
   */
  boolean hasFixed32();
  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   * @return The fixed32.
   */
  int getFixed32();

  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   * @return Whether the sfixed32 field is set.
   */
  boolean hasSfixed32();
  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   * @return The sfixed32.
   */
  int getSfixed32();

  /**
   * <code>optional int32 int32 = 3;</code>
   * @return Whether the int32 field is set.
   */
  boolean hasInt32();
  /**
   * <code>optional int32 int32 = 3;</code>
   * @return The int32.
   */
  int getInt32();

  /**
   * <code>optional uint32 uint32 = 4;</code>
   * @return Whether the uint32 field is set.
   */
  boolean hasUint32();
  /**
   * <code>optional uint32 uint32 = 4;</code>
   * @return The uint32.
   */
  int getUint32();

  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   * @return Whether the fixed64 field is set.
   */
  boolean hasFixed64();
  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   * @return The fixed64.
   */
  long getFixed64();

  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   * @return Whether the sfixed64 field is set.
   */
  boolean hasSfixed64();
  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   * @return The sfixed64.
   */
  long getSfixed64();

  /**
   * <code>optional int64 int64 = 7;</code>
   * @return Whether the int64 field is set.
   */
  boolean hasInt64();
  /**
   * <code>optional int64 int64 = 7;</code>
   * @return The int64.
   */
  long getInt64();

  /**
   * <code>optional uint64 uint64 = 8;</code>
   * @return Whether the uint64 field is set.
   */
  boolean hasUint64();
  /**
   * <code>optional uint64 uint64 = 8;</code>
   * @return The uint64.
   */
  long getUint64();

  /**
   * <code>optional float float = 9;</code>
   * @return Whether the float field is set.
   */
  boolean hasFloat();
  /**
   * <code>optional float float = 9;</code>
   * @return The float.
   */
  float getFloat();

  /**
   * <code>optional double double = 10;</code>
   * @return Whether the double field is set.
   */
  boolean hasDouble();
  /**
   * <code>optional double double = 10;</code>
   * @return The double.
   */
  double getDouble();

  /**
   * <code>optional bool bool = 11;</code>
   * @return Whether the bool field is set.
   */
  boolean hasBool();
  /**
   * <code>optional bool bool = 11;</code>
   * @return The bool.
   */
  boolean getBool();

  /**
   * <code>optional string string = 12;</code>
   * @return Whether the string field is set.
   */
  boolean hasString();
  /**
   * <code>optional string string = 12;</code>
   * @return The string.
   */
  java.lang.String getString();
  /**
   * <code>optional string string = 12;</code>
   * @return The bytes for string.
   */
  com.google.protobuf.ByteString
      getStringBytes();

  /**
   * <code>optional bytes bytes = 13;</code>
   * @return Whether the bytes field is set.
   */
  boolean hasBytes();
  /**
   * <code>optional bytes bytes = 13;</code>
   * @return The bytes.
   */
  com.google.protobuf.ByteString getBytes();
}
/**
 * Protobuf type {@code it.auties.protobuf.ScalarMessage}
 */
public  static final class ScalarMessage extends
    com.google.protobuf.GeneratedMessageLite<
        ScalarMessage, ScalarMessage.Builder> implements
    // @@protoc_insertion_point(message_implements:it.auties.protobuf.ScalarMessage)
    ScalarMessageOrBuilder {
  private ScalarMessage() {
    string_ = "";
    bytes_ = com.google.protobuf.ByteString.EMPTY;
  }
  private int bitField0_;
  public static final int FIXED32_FIELD_NUMBER = 1;
  private int fixed32_;
  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   * @return Whether the fixed32 field is set.
   */
  @java.lang.Override
  public boolean hasFixed32() {
    return ((bitField0_ & 0x00000001) != 0);
  }
  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   * @return The fixed32.
   */
  @java.lang.Override
  public int getFixed32() {
    return fixed32_;
  }
  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   * @param value The fixed32 to set.
   */
  private void setFixed32(int value) {
    bitField0_ |= 0x00000001;
    fixed32_ = value;
  }
  /**
   * <code>optional fixed32 fixed32 = 1;</code>
   */
  private void clearFixed32() {
    bitField0_ = (bitField0_ & ~0x00000001);
    fixed32_ = 0;
  }

  public static final int SFIXED32_FIELD_NUMBER = 2;
  private int sfixed32_;
  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   * @return Whether the sfixed32 field is set.
   */
  @java.lang.Override
  public boolean hasSfixed32() {
    return ((bitField0_ & 0x00000002) != 0);
  }
  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   * @return The sfixed32.
   */
  @java.lang.Override
  public int getSfixed32() {
    return sfixed32_;
  }
  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   * @param value The sfixed32 to set.
   */
  private void setSfixed32(int value) {
    bitField0_ |= 0x00000002;
    sfixed32_ = value;
  }
  /**
   * <code>optional sfixed32 sfixed32 = 2;</code>
   */
  private void clearSfixed32() {
    bitField0_ = (bitField0_ & ~0x00000002);
    sfixed32_ = 0;
  }

  public static final int INT32_FIELD_NUMBER = 3;
  private int int32_;
  /**
   * <code>optional int32 int32 = 3;</code>
   * @return Whether the int32 field is set.
   */
  @java.lang.Override
  public boolean hasInt32() {
    return ((bitField0_ & 0x00000004) != 0);
  }
  /**
   * <code>optional int32 int32 = 3;</code>
   * @return The int32.
   */
  @java.lang.Override
  public int getInt32() {
    return int32_;
  }
  /**
   * <code>optional int32 int32 = 3;</code>
   * @param value The int32 to set.
   */
  private void setInt32(int value) {
    bitField0_ |= 0x00000004;
    int32_ = value;
  }
  /**
   * <code>optional int32 int32 = 3;</code>
   */
  private void clearInt32() {
    bitField0_ = (bitField0_ & ~0x00000004);
    int32_ = 0;
  }

  public static final int UINT32_FIELD_NUMBER = 4;
  private int uint32_;
  /**
   * <code>optional uint32 uint32 = 4;</code>
   * @return Whether the uint32 field is set.
   */
  @java.lang.Override
  public boolean hasUint32() {
    return ((bitField0_ & 0x00000008) != 0);
  }
  /**
   * <code>optional uint32 uint32 = 4;</code>
   * @return The uint32.
   */
  @java.lang.Override
  public int getUint32() {
    return uint32_;
  }
  /**
   * <code>optional uint32 uint32 = 4;</code>
   * @param value The uint32 to set.
   */
  private void setUint32(int value) {
    bitField0_ |= 0x00000008;
    uint32_ = value;
  }
  /**
   * <code>optional uint32 uint32 = 4;</code>
   */
  private void clearUint32() {
    bitField0_ = (bitField0_ & ~0x00000008);
    uint32_ = 0;
  }

  public static final int FIXED64_FIELD_NUMBER = 5;
  private long fixed64_;
  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   * @return Whether the fixed64 field is set.
   */
  @java.lang.Override
  public boolean hasFixed64() {
    return ((bitField0_ & 0x00000010) != 0);
  }
  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   * @return The fixed64.
   */
  @java.lang.Override
  public long getFixed64() {
    return fixed64_;
  }
  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   * @param value The fixed64 to set.
   */
  private void setFixed64(long value) {
    bitField0_ |= 0x00000010;
    fixed64_ = value;
  }
  /**
   * <code>optional fixed64 fixed64 = 5;</code>
   */
  private void clearFixed64() {
    bitField0_ = (bitField0_ & ~0x00000010);
    fixed64_ = 0L;
  }

  public static final int SFIXED64_FIELD_NUMBER = 6;
  private long sfixed64_;
  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   * @return Whether the sfixed64 field is set.
   */
  @java.lang.Override
  public boolean hasSfixed64() {
    return ((bitField0_ & 0x00000020) != 0);
  }
  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   * @return The sfixed64.
   */
  @java.lang.Override
  public long getSfixed64() {
    return sfixed64_;
  }
  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   * @param value The sfixed64 to set.
   */
  private void setSfixed64(long value) {
    bitField0_ |= 0x00000020;
    sfixed64_ = value;
  }
  /**
   * <code>optional sfixed64 sfixed64 = 6;</code>
   */
  private void clearSfixed64() {
    bitField0_ = (bitField0_ & ~0x00000020);
    sfixed64_ = 0L;
  }

  public static final int INT64_FIELD_NUMBER = 7;
  private long int64_;
  /**
   * <code>optional int64 int64 = 7;</code>
   * @return Whether the int64 field is set.
   */
  @java.lang.Override
  public boolean hasInt64() {
    return ((bitField0_ & 0x00000040) != 0);
  }
  /**
   * <code>optional int64 int64 = 7;</code>
   * @return The int64.
   */
  @java.lang.Override
  public long getInt64() {
    return int64_;
  }
  /**
   * <code>optional int64 int64 = 7;</code>
   * @param value The int64 to set.
   */
  private void setInt64(long value) {
    bitField0_ |= 0x00000040;
    int64_ = value;
  }
  /**
   * <code>optional int64 int64 = 7;</code>
   */
  private void clearInt64() {
    bitField0_ = (bitField0_ & ~0x00000040);
    int64_ = 0L;
  }

  public static final int UINT64_FIELD_NUMBER = 8;
  private long uint64_;
  /**
   * <code>optional uint64 uint64 = 8;</code>
   * @return Whether the uint64 field is set.
   */
  @java.lang.Override
  public boolean hasUint64() {
    return ((bitField0_ & 0x00000080) != 0);
  }
  /**
   * <code>optional uint64 uint64 = 8;</code>
   * @return The uint64.
   */
  @java.lang.Override
  public long getUint64() {
    return uint64_;
  }
  /**
   * <code>optional uint64 uint64 = 8;</code>
   * @param value The uint64 to set.
   */
  private void setUint64(long value) {
    bitField0_ |= 0x00000080;
    uint64_ = value;
  }
  /**
   * <code>optional uint64 uint64 = 8;</code>
   */
  private void clearUint64() {
    bitField0_ = (bitField0_ & ~0x00000080);
    uint64_ = 0L;
  }

  public static final int FLOAT_FIELD_NUMBER = 9;
  private float float_;
  /**
   * <code>optional float float = 9;</code>
   * @return Whether the float field is set.
   */
  @java.lang.Override
  public boolean hasFloat() {
    return ((bitField0_ & 0x00000100) != 0);
  }
  /**
   * <code>optional float float = 9;</code>
   * @return The float.
   */
  @java.lang.Override
  public float getFloat() {
    return float_;
  }
  /**
   * <code>optional float float = 9;</code>
   * @param value The float to set.
   */
  private void setFloat(float value) {
    bitField0_ |= 0x00000100;
    float_ = value;
  }
  /**
   * <code>optional float float = 9;</code>
   */
  private void clearFloat() {
    bitField0_ = (bitField0_ & ~0x00000100);
    float_ = 0F;
  }

  public static final int DOUBLE_FIELD_NUMBER = 10;
  private double double_;
  /**
   * <code>optional double double = 10;</code>
   * @return Whether the double field is set.
   */
  @java.lang.Override
  public boolean hasDouble() {
    return ((bitField0_ & 0x00000200) != 0);
  }
  /**
   * <code>optional double double = 10;</code>
   * @return The double.
   */
  @java.lang.Override
  public double getDouble() {
    return double_;
  }
  /**
   * <code>optional double double = 10;</code>
   * @param value The double to set.
   */
  private void setDouble(double value) {
    bitField0_ |= 0x00000200;
    double_ = value;
  }
  /**
   * <code>optional double double = 10;</code>
   */
  private void clearDouble() {
    bitField0_ = (bitField0_ & ~0x00000200);
    double_ = 0D;
  }

  public static final int BOOL_FIELD_NUMBER = 11;
  private boolean bool_;
  /**
   * <code>optional bool bool = 11;</code>
   * @return Whether the bool field is set.
   */
  @java.lang.Override
  public boolean hasBool() {
    return ((bitField0_ & 0x00000400) != 0);
  }
  /**
   * <code>optional bool bool = 11;</code>
   * @return The bool.
   */
  @java.lang.Override
  public boolean getBool() {
    return bool_;
  }
  /**
   * <code>optional bool bool = 11;</code>
   * @param value The bool to set.
   */
  private void setBool(boolean value) {
    bitField0_ |= 0x00000400;
    bool_ = value;
  }
  /**
   * <code>optional bool bool = 11;</code>
   */
  private void clearBool() {
    bitField0_ = (bitField0_ & ~0x00000400);
    bool_ = false;
  }

  public static final int STRING_FIELD_NUMBER = 12;
  private java.lang.String string_;
  /**
   * <code>optional string string = 12;</code>
   * @return Whether the string field is set.
   */
  @java.lang.Override
  public boolean hasString() {
    return ((bitField0_ & 0x00000800) != 0);
  }
  /**
   * <code>optional string string = 12;</code>
   * @return The string.
   */
  @java.lang.Override
  public java.lang.String getString() {
    return string_;
  }
  /**
   * <code>optional string string = 12;</code>
   * @return The bytes for string.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getStringBytes() {
    return com.google.protobuf.ByteString.copyFromUtf8(string_);
  }
  /**
   * <code>optional string string = 12;</code>
   * @param value The string to set.
   */
  private void setString(
      java.lang.String value) {
    java.lang.Class<?> valueClass = value.getClass();
bitField0_ |= 0x00000800;
    string_ = value;
  }
  /**
   * <code>optional string string = 12;</code>
   */
  private void clearString() {
    bitField0_ = (bitField0_ & ~0x00000800);
    string_ = getDefaultInstance().getString();
  }
  /**
   * <code>optional string string = 12;</code>
   * @param value The bytes for string to set.
   */
  private void setStringBytes(
      com.google.protobuf.ByteString value) {
    string_ = value.toStringUtf8();
    bitField0_ |= 0x00000800;
  }

  public static final int BYTES_FIELD_NUMBER = 13;
  private com.google.protobuf.ByteString bytes_;
  /**
   * <code>optional bytes bytes = 13;</code>
   * @return Whether the bytes field is set.
   */
  @java.lang.Override
  public boolean hasBytes() {
    return ((bitField0_ & 0x00001000) != 0);
  }
  /**
   * <code>optional bytes bytes = 13;</code>
   * @return The bytes.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getBytes() {
    return bytes_;
  }
  /**
   * <code>optional bytes bytes = 13;</code>
   * @param value The bytes to set.
   */
  private void setBytes(com.google.protobuf.ByteString value) {
    java.lang.Class<?> valueClass = value.getClass();
bitField0_ |= 0x00001000;
    bytes_ = value;
  }
  /**
   * <code>optional bytes bytes = 13;</code>
   */
  private void clearBytes() {
    bitField0_ = (bitField0_ & ~0x00001000);
    bytes_ = getDefaultInstance().getBytes();
  }

  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data, extensionRegistry);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data, extensionRegistry);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data, extensionRegistry);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, input);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, input, extensionRegistry);
  }

  public static it.auties.protobuf.Scalar.ScalarMessage parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return parseDelimitedFrom(DEFAULT_INSTANCE, input);
  }

  public static it.auties.protobuf.Scalar.ScalarMessage parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, input);
  }
  public static it.auties.protobuf.Scalar.ScalarMessage parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, input, extensionRegistry);
  }

  public static Builder newBuilder() {
    return (Builder) DEFAULT_INSTANCE.createBuilder();
  }
  public static Builder newBuilder(it.auties.protobuf.Scalar.ScalarMessage prototype) {
    return DEFAULT_INSTANCE.createBuilder(prototype);
  }

  /**
   * Protobuf type {@code it.auties.protobuf.ScalarMessage}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageLite.Builder<
        it.auties.protobuf.Scalar.ScalarMessage, Builder> implements
      // @@protoc_insertion_point(builder_implements:it.auties.protobuf.ScalarMessage)
      it.auties.protobuf.Scalar.ScalarMessageOrBuilder {
    // Construct using it.auties.protobuf.Scalar.ScalarMessage.newBuilder()
    private Builder() {
      super(DEFAULT_INSTANCE);
    }


    /**
     * <code>optional fixed32 fixed32 = 1;</code>
     * @return Whether the fixed32 field is set.
     */
    @java.lang.Override
    public boolean hasFixed32() {
      return instance.hasFixed32();
    }
    /**
     * <code>optional fixed32 fixed32 = 1;</code>
     * @return The fixed32.
     */
    @java.lang.Override
    public int getFixed32() {
      return instance.getFixed32();
    }
    /**
     * <code>optional fixed32 fixed32 = 1;</code>
     * @param value The fixed32 to set.
     * @return This builder for chaining.
     */
    public Builder setFixed32(int value) {
      copyOnWrite();
      instance.setFixed32(value);
      return this;
    }
    /**
     * <code>optional fixed32 fixed32 = 1;</code>
     * @return This builder for chaining.
     */
    public Builder clearFixed32() {
      copyOnWrite();
      instance.clearFixed32();
      return this;
    }

    /**
     * <code>optional sfixed32 sfixed32 = 2;</code>
     * @return Whether the sfixed32 field is set.
     */
    @java.lang.Override
    public boolean hasSfixed32() {
      return instance.hasSfixed32();
    }
    /**
     * <code>optional sfixed32 sfixed32 = 2;</code>
     * @return The sfixed32.
     */
    @java.lang.Override
    public int getSfixed32() {
      return instance.getSfixed32();
    }
    /**
     * <code>optional sfixed32 sfixed32 = 2;</code>
     * @param value The sfixed32 to set.
     * @return This builder for chaining.
     */
    public Builder setSfixed32(int value) {
      copyOnWrite();
      instance.setSfixed32(value);
      return this;
    }
    /**
     * <code>optional sfixed32 sfixed32 = 2;</code>
     * @return This builder for chaining.
     */
    public Builder clearSfixed32() {
      copyOnWrite();
      instance.clearSfixed32();
      return this;
    }

    /**
     * <code>optional int32 int32 = 3;</code>
     * @return Whether the int32 field is set.
     */
    @java.lang.Override
    public boolean hasInt32() {
      return instance.hasInt32();
    }
    /**
     * <code>optional int32 int32 = 3;</code>
     * @return The int32.
     */
    @java.lang.Override
    public int getInt32() {
      return instance.getInt32();
    }
    /**
     * <code>optional int32 int32 = 3;</code>
     * @param value The int32 to set.
     * @return This builder for chaining.
     */
    public Builder setInt32(int value) {
      copyOnWrite();
      instance.setInt32(value);
      return this;
    }
    /**
     * <code>optional int32 int32 = 3;</code>
     * @return This builder for chaining.
     */
    public Builder clearInt32() {
      copyOnWrite();
      instance.clearInt32();
      return this;
    }

    /**
     * <code>optional uint32 uint32 = 4;</code>
     * @return Whether the uint32 field is set.
     */
    @java.lang.Override
    public boolean hasUint32() {
      return instance.hasUint32();
    }
    /**
     * <code>optional uint32 uint32 = 4;</code>
     * @return The uint32.
     */
    @java.lang.Override
    public int getUint32() {
      return instance.getUint32();
    }
    /**
     * <code>optional uint32 uint32 = 4;</code>
     * @param value The uint32 to set.
     * @return This builder for chaining.
     */
    public Builder setUint32(int value) {
      copyOnWrite();
      instance.setUint32(value);
      return this;
    }
    /**
     * <code>optional uint32 uint32 = 4;</code>
     * @return This builder for chaining.
     */
    public Builder clearUint32() {
      copyOnWrite();
      instance.clearUint32();
      return this;
    }

    /**
     * <code>optional fixed64 fixed64 = 5;</code>
     * @return Whether the fixed64 field is set.
     */
    @java.lang.Override
    public boolean hasFixed64() {
      return instance.hasFixed64();
    }
    /**
     * <code>optional fixed64 fixed64 = 5;</code>
     * @return The fixed64.
     */
    @java.lang.Override
    public long getFixed64() {
      return instance.getFixed64();
    }
    /**
     * <code>optional fixed64 fixed64 = 5;</code>
     * @param value The fixed64 to set.
     * @return This builder for chaining.
     */
    public Builder setFixed64(long value) {
      copyOnWrite();
      instance.setFixed64(value);
      return this;
    }
    /**
     * <code>optional fixed64 fixed64 = 5;</code>
     * @return This builder for chaining.
     */
    public Builder clearFixed64() {
      copyOnWrite();
      instance.clearFixed64();
      return this;
    }

    /**
     * <code>optional sfixed64 sfixed64 = 6;</code>
     * @return Whether the sfixed64 field is set.
     */
    @java.lang.Override
    public boolean hasSfixed64() {
      return instance.hasSfixed64();
    }
    /**
     * <code>optional sfixed64 sfixed64 = 6;</code>
     * @return The sfixed64.
     */
    @java.lang.Override
    public long getSfixed64() {
      return instance.getSfixed64();
    }
    /**
     * <code>optional sfixed64 sfixed64 = 6;</code>
     * @param value The sfixed64 to set.
     * @return This builder for chaining.
     */
    public Builder setSfixed64(long value) {
      copyOnWrite();
      instance.setSfixed64(value);
      return this;
    }
    /**
     * <code>optional sfixed64 sfixed64 = 6;</code>
     * @return This builder for chaining.
     */
    public Builder clearSfixed64() {
      copyOnWrite();
      instance.clearSfixed64();
      return this;
    }

    /**
     * <code>optional int64 int64 = 7;</code>
     * @return Whether the int64 field is set.
     */
    @java.lang.Override
    public boolean hasInt64() {
      return instance.hasInt64();
    }
    /**
     * <code>optional int64 int64 = 7;</code>
     * @return The int64.
     */
    @java.lang.Override
    public long getInt64() {
      return instance.getInt64();
    }
    /**
     * <code>optional int64 int64 = 7;</code>
     * @param value The int64 to set.
     * @return This builder for chaining.
     */
    public Builder setInt64(long value) {
      copyOnWrite();
      instance.setInt64(value);
      return this;
    }
    /**
     * <code>optional int64 int64 = 7;</code>
     * @return This builder for chaining.
     */
    public Builder clearInt64() {
      copyOnWrite();
      instance.clearInt64();
      return this;
    }

    /**
     * <code>optional uint64 uint64 = 8;</code>
     * @return Whether the uint64 field is set.
     */
    @java.lang.Override
    public boolean hasUint64() {
      return instance.hasUint64();
    }
    /**
     * <code>optional uint64 uint64 = 8;</code>
     * @return The uint64.
     */
    @java.lang.Override
    public long getUint64() {
      return instance.getUint64();
    }
    /**
     * <code>optional uint64 uint64 = 8;</code>
     * @param value The uint64 to set.
     * @return This builder for chaining.
     */
    public Builder setUint64(long value) {
      copyOnWrite();
      instance.setUint64(value);
      return this;
    }
    /**
     * <code>optional uint64 uint64 = 8;</code>
     * @return This builder for chaining.
     */
    public Builder clearUint64() {
      copyOnWrite();
      instance.clearUint64();
      return this;
    }

    /**
     * <code>optional float float = 9;</code>
     * @return Whether the float field is set.
     */
    @java.lang.Override
    public boolean hasFloat() {
      return instance.hasFloat();
    }
    /**
     * <code>optional float float = 9;</code>
     * @return The float.
     */
    @java.lang.Override
    public float getFloat() {
      return instance.getFloat();
    }
    /**
     * <code>optional float float = 9;</code>
     * @param value The float to set.
     * @return This builder for chaining.
     */
    public Builder setFloat(float value) {
      copyOnWrite();
      instance.setFloat(value);
      return this;
    }
    /**
     * <code>optional float float = 9;</code>
     * @return This builder for chaining.
     */
    public Builder clearFloat() {
      copyOnWrite();
      instance.clearFloat();
      return this;
    }

    /**
     * <code>optional double double = 10;</code>
     * @return Whether the double field is set.
     */
    @java.lang.Override
    public boolean hasDouble() {
      return instance.hasDouble();
    }
    /**
     * <code>optional double double = 10;</code>
     * @return The double.
     */
    @java.lang.Override
    public double getDouble() {
      return instance.getDouble();
    }
    /**
     * <code>optional double double = 10;</code>
     * @param value The double to set.
     * @return This builder for chaining.
     */
    public Builder setDouble(double value) {
      copyOnWrite();
      instance.setDouble(value);
      return this;
    }
    /**
     * <code>optional double double = 10;</code>
     * @return This builder for chaining.
     */
    public Builder clearDouble() {
      copyOnWrite();
      instance.clearDouble();
      return this;
    }

    /**
     * <code>optional bool bool = 11;</code>
     * @return Whether the bool field is set.
     */
    @java.lang.Override
    public boolean hasBool() {
      return instance.hasBool();
    }
    /**
     * <code>optional bool bool = 11;</code>
     * @return The bool.
     */
    @java.lang.Override
    public boolean getBool() {
      return instance.getBool();
    }
    /**
     * <code>optional bool bool = 11;</code>
     * @param value The bool to set.
     * @return This builder for chaining.
     */
    public Builder setBool(boolean value) {
      copyOnWrite();
      instance.setBool(value);
      return this;
    }
    /**
     * <code>optional bool bool = 11;</code>
     * @return This builder for chaining.
     */
    public Builder clearBool() {
      copyOnWrite();
      instance.clearBool();
      return this;
    }

    /**
     * <code>optional string string = 12;</code>
     * @return Whether the string field is set.
     */
    @java.lang.Override
    public boolean hasString() {
      return instance.hasString();
    }
    /**
     * <code>optional string string = 12;</code>
     * @return The string.
     */
    @java.lang.Override
    public java.lang.String getString() {
      return instance.getString();
    }
    /**
     * <code>optional string string = 12;</code>
     * @return The bytes for string.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString
        getStringBytes() {
      return instance.getStringBytes();
    }
    /**
     * <code>optional string string = 12;</code>
     * @param value The string to set.
     * @return This builder for chaining.
     */
    public Builder setString(
        java.lang.String value) {
      copyOnWrite();
      instance.setString(value);
      return this;
    }
    /**
     * <code>optional string string = 12;</code>
     * @return This builder for chaining.
     */
    public Builder clearString() {
      copyOnWrite();
      instance.clearString();
      return this;
    }
    /**
     * <code>optional string string = 12;</code>
     * @param value The bytes for string to set.
     * @return This builder for chaining.
     */
    public Builder setStringBytes(
        com.google.protobuf.ByteString value) {
      copyOnWrite();
      instance.setStringBytes(value);
      return this;
    }

    /**
     * <code>optional bytes bytes = 13;</code>
     * @return Whether the bytes field is set.
     */
    @java.lang.Override
    public boolean hasBytes() {
      return instance.hasBytes();
    }
    /**
     * <code>optional bytes bytes = 13;</code>
     * @return The bytes.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getBytes() {
      return instance.getBytes();
    }
    /**
     * <code>optional bytes bytes = 13;</code>
     * @param value The bytes to set.
     * @return This builder for chaining.
     */
    public Builder setBytes(com.google.protobuf.ByteString value) {
      copyOnWrite();
      instance.setBytes(value);
      return this;
    }
    /**
     * <code>optional bytes bytes = 13;</code>
     * @return This builder for chaining.
     */
    public Builder clearBytes() {
      copyOnWrite();
      instance.clearBytes();
      return this;
    }

    // @@protoc_insertion_point(builder_scope:it.auties.protobuf.ScalarMessage)
  }
  @java.lang.Override
  @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
  protected final java.lang.Object dynamicMethod(
      com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
      java.lang.Object arg0, java.lang.Object arg1) {
    switch (method) {
      case NEW_MUTABLE_INSTANCE: {
        return new it.auties.protobuf.Scalar.ScalarMessage();
      }
      case NEW_BUILDER: {
        return new Builder();
      }
      case BUILD_MESSAGE_INFO: {
          java.lang.Object[] objects = new java.lang.Object[] {
            "bitField0_",
            "fixed32_",
            "sfixed32_",
            "int32_",
            "uint32_",
            "fixed64_",
            "sfixed64_",
            "int64_",
            "uint64_",
            "float_",
            "double_",
            "bool_",
            "string_",
            "bytes_",
          };
          java.lang.String info =
              "\u0001\r\u0000\u0001\u0001\r\r\u0000\u0000\u0000\u0001\u1006\u0000\u0002\u100d\u0001" +
              "\u0003\u1004\u0002\u0004\u100b\u0003\u0005\u1005\u0004\u0006\u100e\u0005\u0007\u1002" +
              "\u0006\b\u1003\u0007\t\u1001\b\n\u1000\t\u000b\u1007\n\f\u1008\u000b\r\u100a\f";
          return newMessageInfo(DEFAULT_INSTANCE, info, objects);
      }
      // fall through
      case GET_DEFAULT_INSTANCE: {
        return DEFAULT_INSTANCE;
      }
      case GET_PARSER: {
        com.google.protobuf.Parser<it.auties.protobuf.Scalar.ScalarMessage> parser = PARSER;
        if (parser == null) {
          synchronized (it.auties.protobuf.Scalar.ScalarMessage.class) {
            parser = PARSER;
            if (parser == null) {
              parser =
                  new DefaultInstanceBasedParser<it.auties.protobuf.Scalar.ScalarMessage>(
                      DEFAULT_INSTANCE);
              PARSER = parser;
            }
          }
        }
        return parser;
    }
    case GET_MEMOIZED_IS_INITIALIZED: {
      return (byte) 1;
    }
    case SET_MEMOIZED_IS_INITIALIZED: {
      return null;
    }
    }
    throw new UnsupportedOperationException();
  }


  // @@protoc_insertion_point(class_scope:it.auties.protobuf.ScalarMessage)
  private static final it.auties.protobuf.Scalar.ScalarMessage DEFAULT_INSTANCE;
  static {
    ScalarMessage defaultInstance = new ScalarMessage();
    // New instances are implicitly immutable so no need to make
    // immutable.
    DEFAULT_INSTANCE = defaultInstance;
    com.google.protobuf.GeneratedMessageLite.registerDefaultInstance(
      ScalarMessage.class, defaultInstance);
  }

  public static it.auties.protobuf.Scalar.ScalarMessage getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static volatile com.google.protobuf.Parser<ScalarMessage> PARSER;

  public static com.google.protobuf.Parser<ScalarMessage> parser() {
    return DEFAULT_INSTANCE.getParserForType();
  }
}


static {
}

// @@protoc_insertion_point(outer_class_scope)
}

ModernProtobuf's model is 65x times smaller than Google's!

Performance

Reading that the schema is so much smaller, you might think that I had to compromise on performance. Let's benchmark how much it takes to deserialize 1000 times a message created from the ScalarMessage.proto example: Here is the source for the test in case you want to run it yourself. Here are the results:

Benchmark                                       Mode  Cnt    Score   Error  Units
PerformanceBenchmark.modernProtobuf             avgt    5  104.093 ± 0.630  us/op
PerformanceBenchmark.googleProtobuf             avgt    5  108.120 ± 0.698  us/op
PerformanceBenchmark.googleLiteProtobuf         avgt    5  169.939 ± 0.769  us/op

ModernProtobuf is the fastest

I'm committed to maintain ModernProtobuf's performance, so, if under any edge cases its performance doesn't live up to expectation, I'm happy to work on it.

About

A modern implementation of protoc to serialize, deserialize and generate java sources from protobuf schemas

Topics

Resources

Stars

Watchers

Forks

Languages