net.sf.taverna.raven.repository
Class BasicArtifact

java.lang.Object
  extended by net.sf.taverna.raven.repository.BasicArtifact
All Implemented Interfaces:
java.lang.Comparable, Artifact
Direct Known Subclasses:
ArtifactImpl

public class BasicArtifact
extends java.lang.Object
implements Artifact

Simple base artifact class, a bean with three strings for groupId, artifactId and version. Artifacts are considered as equal if all three strings match.

Author:
Tom Oinn, Stian Soiland-Reyes

Constructor Summary
BasicArtifact(Artifact other)
          Construct a BasicArtifact as a copy of another artifact
BasicArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
          Construct a BasicArtifact from the given values
 
Method Summary
 int compareTo(java.lang.Object other)
          Compare with another object.
 boolean equals(java.lang.Object other)
          Compare with another object.
 java.lang.String getArtifactId()
          Get the artifact ID for this Artifact
 java.lang.String getGroupId()
          Get the group ID for this Artifact
 java.lang.String getVersion()
          Get the version for this Artifact, the version is not constrained to any particular format but is generally a period separated list of integers under lexicographical ordering.
 int hashCode()
          Calculate the hash code of the artifact.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicArtifact

public BasicArtifact(Artifact other)
Construct a BasicArtifact as a copy of another artifact

Parameters:
other - Artifact whose group/artifact/version values to copy

BasicArtifact

public BasicArtifact(java.lang.String groupId,
                     java.lang.String artifactId,
                     java.lang.String version)
Construct a BasicArtifact from the given values

Parameters:
groupId -
artifactId -
version -
Method Detail

compareTo

public int compareTo(java.lang.Object other)
Compare with another object. If the other instance is an Artifact, it will be compared by group, artifact and version in that order.

Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object other)
Compare with another object.

Specified by:
equals in interface Artifact
Overrides:
equals in class java.lang.Object
Parameters:
other - Object to compare
Returns:
true if the other object is also an instance of Artifact and all fields (artifactId, groupId and version) are equal according to string comparison
See Also:
Artifact.equals(Object), Object.equals(Object)

getArtifactId

public java.lang.String getArtifactId()
Description copied from interface: Artifact
Get the artifact ID for this Artifact

Specified by:
getArtifactId in interface Artifact
Returns:
The artifactId

getGroupId

public java.lang.String getGroupId()
Description copied from interface: Artifact
Get the group ID for this Artifact

Specified by:
getGroupId in interface Artifact
Returns:
The groupId

getVersion

public java.lang.String getVersion()
Description copied from interface: Artifact
Get the version for this Artifact, the version is not constrained to any particular format but is generally a period separated list of integers under lexicographical ordering.

Specified by:
getVersion in interface Artifact
Returns:
The version

hashCode

public int hashCode()
Calculate the hash code of the artifact.

Specified by:
hashCode in interface Artifact
Overrides:
hashCode in class java.lang.Object
Returns:
hashcode of the concatenation of the three string fields
See Also:
Artifact.hashCode(), Object.hashCode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object