minor: simplify hashCode() in CenterDomain

This commit is contained in:
Michael Vorburger
2020-06-02 21:15:36 +02:00
committed by Michael Vorburger ⛑️
parent 60dd63d55f
commit c95fb17f6e
@@ -29,23 +29,24 @@ public class CenterDomain implements Comparable<CenterDomain> {
private final static Logger LOG = LoggerFactory.getLogger(CenterDomain.class); private final static Logger LOG = LoggerFactory.getLogger(CenterDomain.class);
public static class Builder { public static class Builder {
private Integer id; private final Integer id;
private String accountNo; private final String accountNo;
private HashMap<String, Object> status; private final HashMap<String, Object> status;
private boolean active; private final boolean active;
private String name; private final String name;
private String externalId; private final String externalId;
private Integer staffId; private final Integer staffId;
private Integer officeId; private final Integer officeId;
private String officeName; private final String officeName;
private String hierarchy; private final String hierarchy;
private ArrayList<HashMap> groupMembers; private final ArrayList<HashMap> groupMembers;
private Builder(final Integer id, final Integer statusid, final String statuscode, final String statusvalue, final boolean active, private Builder(final Integer id, final Integer statusid, final String statuscode, final String statusvalue, final boolean active,
final String name, final String externalId, final Integer staffId, final int officeID, final String officeName, final String name, final String externalId, final Integer staffId, final int officeID, final String officeName,
final String hierarchy, final ArrayList<HashMap> groupMembers) { final String hierarchy, final ArrayList<HashMap> groupMembers) {
this.id = id; this.id = id;
this.status = new HashMap<String, Object>(); this.accountNo = null;
this.status = new HashMap<>();
this.status.put("id", statusid); this.status.put("id", statusid);
this.status.put("code", statuscode); this.status.put("code", statuscode);
this.status.put("value", statusvalue); this.status.put("value", statusvalue);
@@ -88,7 +89,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
final String hierarchy, final ArrayList<HashMap> groupMembers) { final String hierarchy, final ArrayList<HashMap> groupMembers) {
this.id = id; this.id = id;
this.accountNo = accountNo; this.accountNo = accountNo;
this.status = new HashMap<String, Object>(); this.status = new HashMap<>();
this.status.put("id", statusid); this.status.put("id", statusid);
this.status.put("code", statuscode); this.status.put("code", statuscode);
this.status.put("value", statusvalue); this.status.put("value", statusvalue);
@@ -230,15 +231,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
hash += this.id; hash += this.id;
} }
if (this.status != null) { if (this.status != null) {
if ((Double) this.status.get("id") >= 0) { hash += this.status.hashCode();
hash = (int) (hash + (Double) this.status.get("id"));
}
if ((String) this.status.get("code") != null) {
hash += this.status.get("code").hashCode();
}
if ((String) this.status.get("value") != null) {
hash += this.status.get("value").hashCode();
}
} }
if (this.name != null) { if (this.name != null) {
hash += this.name.hashCode(); hash += this.name.hashCode();