Package org.codehaus.mojo.mrm.api.maven
Class Artifact
java.lang.Object
org.codehaus.mojo.mrm.api.maven.Artifact
- All Implemented Interfaces:
Comparable<Artifact>
Represents a specific artifact in a Maven repository. Implements
Comparable
to sort based on
getGroupId()
and then getName()
.- Since:
- 1.0
-
Constructor Summary
ConstructorDescriptionAn artifact.Artifact
(String groupId, String artifactId, String version, String type, long timestamp, int buildNumber) A timestamped snapshot artifact.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
Modifier and TypeMethodDescriptionint
boolean
boolean
equalSnapshots
(Artifact artifact) More lax version ofequals(Object)
that matches SNAPSHOTs with their corresponding timestamped versions.Returns the artifactId of the artifact.Returns the name of the artifact.Returns the build number of the artifact (may benull
).Returns the classifier of the artifact (may benull
).Returns the groupId of the artifact.getName()
Returns the name of the artifact.Returns the timestamp of the artifact (may benull
).Returns the timestamp (formatted as ayyyyMMdd.HHmmss
string) of the artifact (may benull
).Returns the timestamp version.getType()
Returns the type of the artifact.Returns the version of the artifact.int
hashCode()
boolean
Returnstrue
if and only if the artifact is a SNAPSHOT artifact.toString()
-
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 (ornull
).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
A classified snapshot artifact.- Parameters:
groupId
- The groupId.artifactId
- The artifactId.version
- The version.classifier
- The classifier (ornull
).type
- The type.- Since:
- 1.0
-
Artifact
An artifact.- Parameters:
groupId
- The groupId.artifactId
- The artifactId.version
- The version.type
- The type.- Since:
- 1.0
-
-
Method Details
-
getName
Returns the name of the artifact.- Returns:
- the name of the artifact.
- Since:
- 1.0
-
getBaseVersionName
Returns the name of the artifact.- Returns:
- the name of the artifact.
- Since:
- 1.0
-
getGroupId
Returns the groupId of the artifact.- Returns:
- the groupId of the artifact.
- Since:
- 1.0
-
getArtifactId
Returns the artifactId of the artifact.- Returns:
- the artifactId of the artifact.
- Since:
- 1.0
-
getVersion
Returns the version of the artifact.- Returns:
- the version of the artifact.
- Since:
- 1.0
-
getType
Returns the type of the artifact.- Returns:
- the type of the artifact.
- Since:
- 1.0
-
getClassifier
Returns the classifier of the artifact (may benull
).- Returns:
- the classifier of the artifact (may be
null
). - Since:
- 1.0
-
getTimestamp
Returns the timestamp of the artifact (may benull
).- Returns:
- the timestamp of the artifact (may be
null
). - Since:
- 1.0
-
getBuildNumber
Returns the build number of the artifact (may benull
).- Returns:
- the build number of the artifact (may be
null
). - Since:
- 1.0
-
getTimestampString
Returns the timestamp (formatted as ayyyyMMdd.HHmmss
string) of the artifact (may benull
).- Returns:
- the timestamp (formatted as a
yyyyMMdd.HHmmss
string) of the artifact (may benull
). - Since:
- 1.0
-
getTimestampVersion
Returns the timestamp version.- For release artifacts, this will be the same as
getVersion()
. - For non-timestamped SNAPSHOTS, this will be the same as
getVersion()
. - For timestamped SNAPSHOTS, this will be the timestamp version, i.e. the
getVersion()
withSNAPSHOT
replaced bygetTimestampString()
and thegetBuildNumber()
separated by a-
.
- Returns:
- the timestamp version.
- Since:
- 1.0
- For release artifacts, this will be the same as
-
isSnapshot
public boolean isSnapshot()Returnstrue
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
-
equalSnapshots
More lax version ofequals(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() -
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Artifact>
-