Open fdietze opened 11 years ago
I'm pretty sure you can't use this for now since there's no support in ScalaBuff for reflection/descriptors, which this relies on (I think).
For a full Message.Builder interface support, I'll need to implement setField, clearField, etc. methods which take FieldDescriptors as parameters and this means a lot of added complexity.
If you want human readable messages, just use yourMessage.toString. :) Case classes have automatically generated toString methods which should be adequate for readability (the only exception are ByteString fields, which themselves don't have a proper toString method). For better readability, one solution would be custom toString methods which would increase message class size, or even better, an universal "ScalaBuffTextFormat" which could perhaps rely on the shapeless library for case class introspection.
Thanks, I'm aware of toString but this does not let me modify the data. Im experimenting with a gui (https://code.google.com/p/protobufeditor/) right now. This seems to work for me so far.
Perhaps you could use Java protobufs to merge in a ScalaBuff-serialized message (I hope you can unserialize a MessageLite message class with a Message message class) and then load that?
Yes, that's another possibility. I will play with that a little bit. Thank you.
My pleasure.
I now have both the ScalaBuff-sbt plugin and the protobuf-sbt plugin in my project. Code generation works well, but I cannot compile. Both classes are in the same package with the same class names and I get:
ClassName is already defined as object ClassName
Any suggestions?
You can't have a Java class and a Scala class (object) with the same name in the same packages in your project.
Perhaps you can move one of the classes into another package?
You can also just delete the pretty much empty object with the same name as the Java class ("outer" proto message object, the one with the empty registerAllExtensions method) since it doesn't have any purpose right now.
Only deleting the object isn't enough. The other classes also have the same names. And I don't see the possibility to automatically move the classes to other packages. Is it possible to introduce an option in scalabuff to overwrite the package names? Maybe introduce a prefix at a specific package level.
https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/TextFormat
TextFormat interacts with the message Interface, while ScalaBuff uses MessageLite. I didn't find a way to convert.