What you get from scala protobuf

jeffplaisance edited this page Sep 14, 2010 · 3 revisions

scala-protobuf creates a message class, a builder class, and a parser object for each of your message types in your .proto files.

the message class has:
a constructor with one parameter per field
write methods that write the message to an output stream using writeTo or writeDelimitedTo
a method called javaMessage that converts the message into the corresponding java message type
a get method that gets parameters by number
uses Option for optional fields
uses List for repeated fields

the builder class has:
a constructor with one parameter per required field
a var for every optional field with type Option[FieldType] and default None
a ListBuffer for every repeated field
a set method that allows setting required and optional fields by number
a build method that returns an instance of the message class using the current state of the builder

the parser object has:
parse methods that parse a message from an input stream using parseFrom or parseDelimitedFrom
a method called javaToScala that converts a java message into the corresponding scala message type

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.