Package org.glassfish.spec
Class Artifact
- java.lang.Object
-
- org.glassfish.spec.Artifact
-
public final class Artifact extends java.lang.Object
Represent the API JAR file as a Maven artifact.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
artifactId
Artifact artifactId.private static java.lang.String[]
BUILD_NUMBER_SEPARATORS
Characters used to separate the build number within the version.private java.lang.String
buildNumber
Artifact build number.private java.lang.String
groupId
Artifact groupId.static java.lang.String
SNAPSHOT_QUALIFIER
The Maven SNAPSHOT qualifier.private org.apache.maven.artifact.versioning.ArtifactVersion
version
Artifact version.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
static Artifact
fromJar(java.util.jar.JarFile jar)
Create anArtifact
instance from a given JAR file.java.lang.String
getAbsoluteVersion()
Get the normalized release version for this artifact.java.lang.String
getArtifactId()
Get the artifactId for this artifact.java.lang.String
getBuildNumber()
Get the build number of this artifact.private static java.lang.String
getBuildNumber(java.lang.String qualifier)
Parse a version qualifier and extract the build number.java.lang.String
getGroupId()
Get the groupId for this artifact.private static java.util.zip.ZipEntry
getPomPropertiesFile(java.util.jar.JarFile jar)
Get theZipEntry
forpom.properties
in the given JAR file.org.apache.maven.artifact.versioning.ArtifactVersion
getVersion()
Get the version for this artifact.int
hashCode()
void
setArtifactId(java.lang.String aId)
Set the artifactId of this artifact.void
setGroupId(java.lang.String gId)
Set the groupId of this artifact.void
setVersion(java.lang.String v)
Set the version of this artifact.static java.lang.String
stripSnapshotQualifier(java.lang.String qualifier)
Strip the SNAPSHOT qualifier from a given qualifier.java.lang.String
toString()
-
-
-
Field Detail
-
groupId
private java.lang.String groupId
Artifact groupId.
-
artifactId
private java.lang.String artifactId
Artifact artifactId.
-
version
private org.apache.maven.artifact.versioning.ArtifactVersion version
Artifact version.
-
buildNumber
private java.lang.String buildNumber
Artifact build number.
-
BUILD_NUMBER_SEPARATORS
private static final java.lang.String[] BUILD_NUMBER_SEPARATORS
Characters used to separate the build number within the version.
-
SNAPSHOT_QUALIFIER
public static final java.lang.String SNAPSHOT_QUALIFIER
The Maven SNAPSHOT qualifier.- See Also:
- Constant Field Values
-
-
Method Detail
-
stripSnapshotQualifier
public static java.lang.String stripSnapshotQualifier(java.lang.String qualifier)
Strip the SNAPSHOT qualifier from a given qualifier.- Parameters:
qualifier
- the qualifier to process- Returns:
- a non SNAPSHOT qualifier
-
getBuildNumber
private static java.lang.String getBuildNumber(java.lang.String qualifier)
Parse a version qualifier and extract the build number.- Parameters:
qualifier
- the qualifier to process- Returns:
- the build number, or
null
if none found
-
getArtifactId
public java.lang.String getArtifactId()
Get the artifactId for this artifact.- Returns:
- the artifactId
-
getGroupId
public java.lang.String getGroupId()
Get the groupId for this artifact.- Returns:
- the groupId
-
getVersion
public org.apache.maven.artifact.versioning.ArtifactVersion getVersion()
Get the version for this artifact.- Returns:
- the version
-
getAbsoluteVersion
public java.lang.String getAbsoluteVersion()
Get the normalized release version for this artifact.- Returns:
- the version
-
setArtifactId
public void setArtifactId(java.lang.String aId)
Set the artifactId of this artifact.- Parameters:
aId
- the artifactId value to use
-
setGroupId
public void setGroupId(java.lang.String gId)
Set the groupId of this artifact.- Parameters:
gId
- the artifactId value to use
-
setVersion
public void setVersion(java.lang.String v)
Set the version of this artifact.- Parameters:
v
- the artifactId value to use
-
getBuildNumber
public java.lang.String getBuildNumber()
Get the build number of this artifact.- Returns:
- the build number
-
getPomPropertiesFile
private static java.util.zip.ZipEntry getPomPropertiesFile(java.util.jar.JarFile jar)
Get theZipEntry
forpom.properties
in the given JAR file.- Parameters:
jar
- the jar file to process- Returns:
- the
ZipEntry
if found,null
otherwise
-
fromJar
public static Artifact fromJar(java.util.jar.JarFile jar) throws java.io.IOException
Create anArtifact
instance from a given JAR file.- Parameters:
jar
- the jar file to process- Returns:
- the create
Artifact
instance - Throws:
java.io.IOException
- if an error occurs while reading JAR file entries
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-