From e624b3afa64a35f248a693ff838aa7549dbe786c Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Thu, 30 Jun 2011 13:51:49 +0000 Subject: [PATCH] [LMS-2301] missing equals & hashCode for EMailAddress + dependency check for Hierarchical Content API SVN: 21938 --- common/resource/dependency-structure.ddf | 12 +++- .../cisd/common/mail/EMailAddress.java | 57 ++++++++++++++++++- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/common/resource/dependency-structure.ddf b/common/resource/dependency-structure.ddf index 6be78bfa1ed..89f093efe50 100644 --- a/common/resource/dependency-structure.ddf +++ b/common/resource/dependency-structure.ddf @@ -43,4 +43,14 @@ layer layer3 = [db] [parser] check layeringOf layer0 layer1 layer2 -check [parser] independentOf ${package}.exceptions.UserFailureException \ No newline at end of file +check [parser] independentOf ${package}.exceptions.UserFailureException + +########################## +# Hierarchical Content API + +[hierarchical-content-api] = ${package}.io.hierarchical_content.api.* +[java] = java* *.annotation.* *.exceptions.* ch.systemsx.cisd.base.io.IRandomAccessFile +[java-and-hierarchical-content-api] = [java] [hierarchical-content-api] + +check sets [hierarchical-content-api] +check [hierarchical-content-api] dependentOnlyOn [java-and-hierarchical-content-api] \ No newline at end of file diff --git a/common/source/java/ch/systemsx/cisd/common/mail/EMailAddress.java b/common/source/java/ch/systemsx/cisd/common/mail/EMailAddress.java index 276bdb4dd68..518baaec3cb 100644 --- a/common/source/java/ch/systemsx/cisd/common/mail/EMailAddress.java +++ b/common/source/java/ch/systemsx/cisd/common/mail/EMailAddress.java @@ -35,7 +35,7 @@ public final class EMailAddress implements Serializable { this(emailAddressOrNull, null); } - + public EMailAddress(String emailAddressOrNull, String personalNameOrNull) { this.emailAddressOrNull = emailAddressOrNull; @@ -68,9 +68,60 @@ public final class EMailAddress implements Serializable return "EmailAddress{email=" + emailAddressOrNull + "}"; } else { - return "EmailAddress{email=" + emailAddressOrNull + ", personalname='" + personalNameOrNull - + "'}"; + return "EmailAddress{email=" + emailAddressOrNull + ", personalname='" + + personalNameOrNull + "'}"; + } + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = + prime * result + ((emailAddressOrNull == null) ? 0 : emailAddressOrNull.hashCode()); + result = + prime * result + ((personalNameOrNull == null) ? 0 : personalNameOrNull.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (!(obj instanceof EMailAddress)) + { + return false; + } + EMailAddress other = (EMailAddress) obj; + if (emailAddressOrNull == null) + { + if (other.emailAddressOrNull != null) + { + return false; + } + } else if (!emailAddressOrNull.equals(other.emailAddressOrNull)) + { + return false; + } + if (personalNameOrNull == null) + { + if (other.personalNameOrNull != null) + { + return false; + } + } else if (!personalNameOrNull.equals(other.personalNameOrNull)) + { + return false; } + return true; } } -- GitLab