79629201

Date: 2025-05-19 17:23:03
Score: 1
Natty:
Report link

Just to build upon the answer from @NickNgn, could even make SensitiveInfo a generic class for other data types as well. Something like this:

record SensitiveInfo<T>(T value) {

  @Override
  public String toString() {
    return "SensitiveInfo{" +
           "value=*****" +
           "}";
  }
}

Then could use for different types like this:

record SomeRecord(..., SensitiveInfo<byte[]> byteField, SensitiveInfo<String> stringField)
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @NickNgn
  • Low reputation (0.5):
Posted by: Bradford2000