From 1880e22d2265e1f2666a16ac0ef5a5e907863c9d Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Sun, 3 May 2015 07:18:53 -0400 Subject: [PATCH] added equals, hashcode, and tostring Former-commit-id: d29f3d164d55448bf8a38ef73f2071f44b67a865 --- .../dependencycheck/xml/pom/License.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/pom/License.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/pom/License.java index 3a9f26efe..ba185079e 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/pom/License.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/pom/License.java @@ -82,4 +82,51 @@ public class License { this.name = name; } + /** + * Generated hashCode implementation. + * + * @return the hash code + */ + @Override + public int hashCode() { + int hash = 7; + hash = 89 * hash + (this.url != null ? this.url.hashCode() : 0); + hash = 89 * hash + (this.name != null ? this.name.hashCode() : 0); + return hash; + } + + /** + * Generated equals method to perform equality check. + * + * @param obj the object to check + * @return true if the objects are equal; otherwise false + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final License other = (License) obj; + if ((this.url == null) ? (other.url != null) : !this.url.equals(other.url)) { + return false; + } + if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { + return false; + } + return true; + } + + /** + * Generated toString. + * + * @return the string representation of the license + */ + @Override + public String toString() { + return "License{" + "url=" + url + ", name=" + name + '}'; + } + }