Remove redundant constructors (#14248)
This commit is contained in:
parent
7464d2b90e
commit
69fe2bb1ae
|
@ -9,13 +9,6 @@ public class Citizen {
|
|||
private String email;
|
||||
private Integer birthYear;
|
||||
|
||||
public Citizen() {
|
||||
}
|
||||
|
||||
public Citizen(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -10,13 +10,6 @@ public class EncryptedCitizen {
|
|||
private Binary email;
|
||||
private Binary birthYear;
|
||||
|
||||
public EncryptedCitizen() {
|
||||
}
|
||||
|
||||
public EncryptedCitizen(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ public class CitizenService {
|
|||
if (encryptionConfig.isAutoEncryption()) {
|
||||
return mongo.save(citizen);
|
||||
} else {
|
||||
EncryptedCitizen encryptedCitizen = new EncryptedCitizen(citizen.getName());
|
||||
EncryptedCitizen encryptedCitizen = new EncryptedCitizen();
|
||||
encryptedCitizen.setName(citizen.getName());
|
||||
if (citizen.getEmail() != null) {
|
||||
encryptedCitizen.setEmail(encrypt(citizen.getEmail(), DETERMINISTIC_ALGORITHM));
|
||||
} else {
|
||||
|
@ -123,7 +124,8 @@ public class CitizenService {
|
|||
private Citizen decrypt(EncryptedCitizen encrypted) {
|
||||
Objects.requireNonNull(encrypted);
|
||||
|
||||
Citizen citizen = new Citizen(encrypted.getName());
|
||||
Citizen citizen = new Citizen();
|
||||
citizen.setName(encrypted.getName());
|
||||
|
||||
BsonValue decryptedBirthYear = encrypted.getBirthYear() != null ? decryptProperty(encrypted.getBirthYear()) : null;
|
||||
if (decryptedBirthYear != null) {
|
||||
|
|
Loading…
Reference in New Issue