Class 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 java.lang.String groupId
      Artifact groupId.
      private static java.lang.String RC_QUALIFIER
      The Release Candidate qualifier.
      private static java.lang.String SNAPSHOT_QUALIFIER
      The Maven SNAPSHOT qualifier.
      private org.apache.maven.artifact.versioning.ArtifactVersion version
      Artifact version.
    • Constructor Summary

      Constructors 
      Constructor Description
      Artifact()
      Create a new Artifact instance.
      Artifact​(java.lang.String gId, java.lang.String aId, java.lang.String v)
      Create a new Artifact instance.
    • 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 an Artifact 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 getGroupId()
      Get the groupId for this artifact.
      private static java.util.zip.ZipEntry getPomPropertiesFile​(java.util.jar.JarFile jar)
      Get the ZipEntry for pom.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 stripSnapshotOrRcQualifier​(java.lang.String version)
      Strip the SNAPSHOT or RC qualifier from a given version.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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.
      • SNAPSHOT_QUALIFIER

        private static final java.lang.String SNAPSHOT_QUALIFIER
        The Maven SNAPSHOT qualifier.
        See Also:
        Constant Field Values
      • RC_QUALIFIER

        private static final java.lang.String RC_QUALIFIER
        The Release Candidate qualifier.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Artifact

        public Artifact()
        Create a new Artifact instance.
      • Artifact

        public Artifact​(java.lang.String gId,
                        java.lang.String aId,
                        java.lang.String v)
        Create a new Artifact instance.
        Parameters:
        gId - the artifact groupId
        aId - the artifact artifactId
        v - the artifact version
    • Method Detail

      • stripSnapshotOrRcQualifier

        public static java.lang.String stripSnapshotOrRcQualifier​(java.lang.String version)
        Strip the SNAPSHOT or RC qualifier from a given version.
        Parameters:
        version - the qualifier to process
        Returns:
        a non SNAPSHOT or RC version
      • 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
      • getPomPropertiesFile

        private static java.util.zip.ZipEntry getPomPropertiesFile​(java.util.jar.JarFile jar)
        Get the ZipEntry for pom.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 an Artifact 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 class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object