Protobuf generated classes can't be subclassed. I suggest create a wrapper type and implement the hashCode()/equals() there.
To generate one .java file for each message, use "option java_multiple_files = true;" in your .proto file. On Wed, Feb 28, 2018 at 5:41 AM Kaushal Hooda <[email protected]> wrote: > Hi, > > The default behaviour for equals/hashCode is checking every single field > for comparison/generating the hash. > > This is problematic for us - we need to override this to use only few > fields (e.g., an ID field). Is there any way to do this, apart from editing > the generated java code every time I run protoc? > > Also, is it possible to generate one .java file for each message type, > instead of having them all inside one huge file for the entire schema? > > -- > 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 post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
