if equals is defined hashCode must be defined too

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1179998 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-10-07 10:57:02 +00:00
parent 659ab05e9f
commit 4e5ff7650c
1 changed files with 17 additions and 0 deletions

View File

@ -271,6 +271,23 @@ public class ArtifactMetadata
return true;
}
@Override
public int hashCode()
{
int result = id != null ? id.hashCode() : 0;
result = 31 * result + ( repositoryId != null ? repositoryId.hashCode() : 0 );
result = 31 * result + ( namespace != null ? namespace.hashCode() : 0 );
result = 31 * result + ( project != null ? project.hashCode() : 0 );
result = 31 * result + ( projectVersion != null ? projectVersion.hashCode() : 0 );
result = 31 * result + ( version != null ? version.hashCode() : 0 );
result = 31 * result + ( fileLastModified != null ? fileLastModified.hashCode() : 0 );
result = 31 * result + (int) ( size ^ ( size >>> 32 ) );
result = 31 * result + ( md5 != null ? md5.hashCode() : 0 );
result = 31 * result + ( sha1 != null ? sha1.hashCode() : 0 );
result = 31 * result + ( whenGathered != null ? whenGathered.hashCode() : 0 );
return result;
}
@Override
public String toString()
{