Code: Select all
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Tested {
private String name;
private String surname;
@ToString.Include(name = "surname")
public String surnameMasked() {
//for simplicity let's say I change everything but first letter to *
return maskDefaultField(surname);
}
}
Code: Select all
//should produce "Tested(name=John, surname=S****)"
public printMasked(Tested tested) {
System.out.println(tested);
}
//should produce "Tested(surname=John, name=Smith)"
public printUnMasked(@Unmasked Tested tested) {
System.out.println(tested);
}
Mobile version