Java protobufs originally only had the option to have the outer class, 
which is consistent with some other languages' protocol buffers. We decided 
to add the "multiple files" option for users to have the option. We 
recommend using the multiple files option in most instances, but continue 
providing both in case historic users are reliant on having the outer class 
or if there are special cases in which a single file would be better.

On Sunday, July 25, 2021 at 11:13:02 AM UTC-7 [email protected] wrote:

> I googled this and found questions like "How to use Protobuf message as 
> java class without a java outer class?" (
> https://stackoverflow.com/questions/60312156/how-to-use-protobuf-message-as-java-class-without-a-java-outer-class)
>  
> which talk about how one might tweak their Protobuf Java code generation. 
> For example, that person wants to avoid having outer classes. The answer 
> tells them about the "multiple files" option.
>
> But I'd like to know why the Java generated code, by default, is split up 
> this way. I didn't notice code split up like that when I used my same 
> Protobuf files to generate Go code. I got just one struct per Protobuf 
> message I defined. In Java, I get two classes per Protobuf message defined, 
> and I can choose between them being nested or in separate files. Why?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/29f0180d-c199-4f53-a47a-8a4ff29ef2bcn%40googlegroups.com.

Reply via email to