Class Artifact

java.lang.Object
org.codehaus.mojo.mrm.api.maven.Artifact
All Implemented Interfaces:
Comparable<Artifact>

public final class Artifact extends Object implements Comparable<Artifact>
Represents a specific artifact in a Maven repository. Implements Comparable to sort based on getGroupId() and then getName().
Since:
1.0
  • Constructor Details

    • 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 Details

    • getName

      public String getName()
      Returns the name of the artifact.
      Returns:
      the name of the artifact.
      Since:
      1.0
    • getBaseVersionName

      public String getBaseVersionName()
      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(Artifact that)
      Specified by:
      compareTo in interface Comparable<Artifact>