add missing hash-code and equals for DownloadArtifactCache (#345)

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-11-14 13:59:45 +01:00
committed by GitHub

View File

@@ -25,7 +25,6 @@ public class DownloadArtifactCache {
* the searching id e.g. sha1, md5
*/
public DownloadArtifactCache(final DownloadType downloadType, final String id) {
super();
this.downloadType = downloadType;
this.id = id;
}
@@ -38,4 +37,31 @@ public class DownloadArtifactCache {
return downloadType;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((downloadType == null) ? 0 : downloadType.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final DownloadArtifactCache other = (DownloadArtifactCache) obj;
if (downloadType != other.downloadType)
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}