record-builder
record-builder copied to clipboard
Auxilliary values
Records by default utilize all values in computation of equals and hashcode
Sometimes that's not what you want.
It's trivial to add a custom implementation of equals and hashcode to the records, but we could also introduce an annotation that could be assigned to record fields to result in custom equals and hashcode appearing in the Bean interface
What do you think? It's not a must-have, but rather useful
Can you give an short description of what that would look like? I don't see how an annotation could help with this.
Mostly just me trying to find drop-in replacements to immutables features: https://immutables.github.io/immutable.html#auxiliary-attributes
If this is to be done, it would mean starting to generate equals, toString and hashCode as default methods in the generated Bean interface. These methods would then omit @Auxilliary-annotated fields from equals and hashCode, and omit @Redacted fields from toString.
This all might also be out of scope for this library, and in hindsight I might be better served making my own little interface-generator that created these three methods on demand..