diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java index ff8ee027dd96499deb37d9d97493ddc977f2cbfb..4094de2990d73a51fdaa1b66670f61ebca039d91 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java +++ b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java @@ -15,6 +15,8 @@ */ package org.openatom.ubml.model.framework.generator.api.entity; +import org.openatom.ubml.common.util.StringUtils; + /** * @Classname MavenDependency * @Description TODO @@ -78,11 +80,24 @@ public class MavenDependency { this.groupId = groupId; } - public boolean equals(MavenDependency source) { - if (source == null) { + @Override + public boolean equals(Object obj) { + if (obj == null) { return false; } - return source.getGroupId().equals(getGroupId()) - && source.getArtifactId().equals(getArtifactId()); + if (obj instanceof MavenDependency) { + MavenDependency otherMavenDependency = (MavenDependency) obj; + return otherMavenDependency.getGroupId().equals(getGroupId()) + && otherMavenDependency.getArtifactId().equals(getArtifactId()); + } + return false; + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (StringUtils.isEmpty(this.getGroupId()) ? 0 : this.getGroupId().hashCode()); + result = 31 * result + (StringUtils.isEmpty(this.getArtifactId()) ? 0 : this.getArtifactId().hashCode()); + return result; } }