You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by tr...@apache.org on 2005/01/13 10:37:44 UTC
cvs commit: maven-components/maven-artifact/src/main/java/org/apache/maven/artifact DefaultArtifact.java
trygvis 2005/01/13 01:37:44
Modified: maven-artifact/src/main/java/org/apache/maven/artifact
DefaultArtifact.java
Log:
o Overriding hashCode() and equals().
Revision Changes Path
1.3 +25 -6 maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java
Index: DefaultArtifact.java
===================================================================
RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultArtifact.java 29 Dec 2004 06:59:23 -0000 1.2
+++ DefaultArtifact.java 13 Jan 2005 09:37:44 -0000 1.3
@@ -122,11 +122,6 @@
//
// ----------------------------------------------------------------------
- public String toString()
- {
- return getId();
- }
-
public String getId()
{
return getGroupId() + ":" +
@@ -140,5 +135,29 @@
return getGroupId() + ":" +
getArtifactId() + ":" +
getType();
+ }
+
+ // ----------------------------------------------------------------------
+ // Object overrides
+ // ----------------------------------------------------------------------
+
+ public String toString()
+ {
+ return getId();
+ }
+
+ public int hashCode()
+ {
+ return getId().hashCode();
+ }
+
+ public boolean equals( Object o )
+ {
+ Artifact other = (Artifact) o;
+
+ return this.groupId.equals( other.getGroupId() ) &&
+ this.artifactId.equals( other.getArtifactId() ) &&
+ this.version.equals( other.getVersion() ) &&
+ this.type.equals( other.getType() );
}
}