org.codehaus.mojo.mrm.api.maven
Class Artifact

java.lang.Object
  extended by org.codehaus.mojo.mrm.api.maven.Artifact
All Implemented Interfaces:
Serializable, Comparable

public final class Artifact
extends Object
implements Serializable, Comparable

Represents a specific artifact in a Maven repository. Implements Comparable to sort based on getGroupId() and then getName().

Since:
1.0
See Also:
Serialized Form

Constructor Summary
Artifact(String groupId, String artifactId, String version, String type)
          An artifact.
Artifact(String groupId, String artifactId, String version, String type, long timestamp, int buildNumber)
          A timestamped snapshot artifact.
Artifact(String groupId, String artifactId, String version, String classifier, String type)
          A classified snapshot artifact.
Artifact(String groupId, String artifactId, String version, String classifier, String type, long timestamp, int buildNumber)
          A timestamped classified snapshot artifact.
 
Method Summary
 int compareTo(Object o)
          
 boolean equals(Object o)
          
 boolean equalSnapshots(Artifact artifact)
          More lax version of equals(Object) that matches SNAPSHOTs with their corresponding timestamped versions.
 String getArtifactId()
          Returns the artifactId of the artifact.
 Integer getBuildNumber()
          Returns the build number of the artifact (may be null).
 String getClassifier()
          Returns the classifier of the artifact (may be null).
 String getGroupId()
          Returns the groupId of the artifact.
 String getName()
          Returns the name of the artifact.
 Long getTimestamp()
          Returns the timestamp of the artifact (may be null).
 String getTimestampString()
          Returns the timestamp (formatted as a yyyyMMdd.HHmmss string) of the artifact (may be null).
 String getTimestampVersion()
          Returns the timestamp version.
 String getType()
          Returns the type of the artifact.
 String getVersion()
          Returns the version of the artifact.
 int hashCode()
          
 boolean isSnapshot()
          Returns true if and only if the artifact is a SNAPSHOT artifact.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Artifact

public Artifact(String groupId,
                String artifactId,
                String version,
                String classifier,
                String type,
                long timestamp,
                int buildNumber)
A timestamped classified snapshot artifact.

Parameters:
groupId - The groupId.
artifactId - The artifactId.
version - The version.
classifier - The classifier (or null).
type - The type.
timestamp - The timestamp.
buildNumber - The build number.
Since:
1.0

Artifact

public Artifact(String groupId,
                String artifactId,
                String version,
                String type,
                long timestamp,
                int buildNumber)
A timestamped snapshot artifact.

Parameters:
groupId - The groupId.
artifactId - The artifactId.
version - The version.
type - The type.
timestamp - The timestamp.
buildNumber - The build number.
Since:
1.0

Artifact

public Artifact(String groupId,
                String artifactId,
                String version,
                String classifier,
                String type)
A classified snapshot artifact.

Parameters:
groupId - The groupId.
artifactId - The artifactId.
version - The version.
classifier - The classifier (or null).
type - The type.
Since:
1.0

Artifact

public Artifact(String groupId,
                String artifactId,
                String version,
                String type)
An artifact.

Parameters:
groupId - The groupId.
artifactId - The artifactId.
version - The version.
type - The type.
Since:
1.0
Method Detail

getName

public String getName()
Returns the name of the artifact.

Returns:
the name of the artifact.
Since:
1.0

getGroupId

public String getGroupId()
Returns the groupId of the artifact.

Returns:
the groupId of the artifact.
Since:
1.0

getArtifactId

public String getArtifactId()
Returns the artifactId of the artifact.

Returns:
the artifactId of the artifact.
Since:
1.0

getVersion

public String getVersion()
Returns the version of the artifact.

Returns:
the version of the artifact.
Since:
1.0

getType

public String getType()
Returns the type of the artifact.

Returns:
the type of the artifact.
Since:
1.0

getClassifier

public String getClassifier()
Returns the classifier of the artifact (may be null).

Returns:
the classifier of the artifact (may be null).
Since:
1.0

getTimestamp

public Long getTimestamp()
Returns the timestamp of the artifact (may be null).

Returns:
the timestamp of the artifact (may be null).
Since:
1.0

getBuildNumber

public Integer getBuildNumber()
Returns the build number of the artifact (may be null).

Returns:
the build number of the artifact (may be null).
Since:
1.0

getTimestampString

public String getTimestampString()
Returns the timestamp (formatted as a yyyyMMdd.HHmmss string) of the artifact (may be null).

Returns:
the timestamp (formatted as a yyyyMMdd.HHmmss string) of the artifact (may be null).
Since:
1.0

getTimestampVersion

public String getTimestampVersion()
Returns the timestamp version.

Returns:
the timestamp version.
Since:
1.0

isSnapshot

public boolean isSnapshot()
Returns true if and only if the artifact is a SNAPSHOT artifact.

Returns:
true if and only if the artifact is a SNAPSHOT artifact.
Since:
1.0

equals

public boolean equals(Object o)

Overrides:
equals in class Object

equalSnapshots

public boolean equalSnapshots(Artifact artifact)
More lax version of equals(Object) that matches SNAPSHOTs with their corresponding timestamped versions.

Parameters:
artifact - the artifact to compare with.
Returns:
true if this artifact is the same as the specified artifact (where timestamps are ignored for SNAPSHOT versions).
Since:
1.0

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object

compareTo

public int compareTo(Object o)

Specified by:
compareTo in interface Comparable


Copyright © 2009-2011 Codehaus. All Rights Reserved.