Refactor equals method
To use the accessor method for username instead of directly accessing the attribute.
This commit is contained in:
parent
ea19f82b8a
commit
de1357cbd1
|
@ -179,8 +179,8 @@ public class User implements UserDetails, CredentialsContainer {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof User) {
|
if (obj instanceof User user) {
|
||||||
return this.username.equals(((User) obj).username);
|
return this.username.equals(user.getUsername());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue