Interface Artifact

  • All Known Implementing Classes:
    DefaultArtifact

    public interface Artifact
    An abstract entity uniquely identified by its coordinates – group identifier, artifact identifier, extension, classifier and version, with optionally associated artifact file.

    Artifact objects are immutable – all methods which modify artifact return a new object and keep the original unmodified.

    Author:
    Mikolaj Izdebski
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getArtifactId()
      Get artifact identifier of this artifact.
      java.lang.String getClassifier()
      Get classifier of this artifact.
      java.lang.String getExtension()
      Get extension of this artifact.
      java.lang.String getGroupId()
      Get group identifier of this artifact.
      java.nio.file.Path getPath()
      Get local path of artifact file or null if artifact is not resolved (doesn't have associated artifact file).
      java.lang.String getVersion()
      Get version of this artifact.
      Artifact setPath​(java.nio.file.Path path)
      Set artifact path.
      Artifact setVersion​(java.lang.String version)
      Set artifact version.
    • Field Detail

      • DEFAULT_EXTENSION

        static final java.lang.String DEFAULT_EXTENSION
        Default artifact extension, used if no explicit extension is specified.
        See Also:
        Constant Field Values
      • DEFAULT_VERSION

        static final java.lang.String DEFAULT_VERSION
        Default artifact version, used if no explicit version is specified.
        See Also:
        Constant Field Values
    • Method Detail

      • getGroupId

        java.lang.String getGroupId()
        Get group identifier of this artifact.
        Returns:
        artifact group identifier, never null.
      • getArtifactId

        java.lang.String getArtifactId()
        Get artifact identifier of this artifact.
        Returns:
        artifact identifier, never null.
      • getExtension

        java.lang.String getExtension()
        Get extension of this artifact.
        Returns:
        artifact extension, never null.
      • getClassifier

        java.lang.String getClassifier()
        Get classifier of this artifact.
        Returns:
        artifact classifier, never null.
      • getVersion

        java.lang.String getVersion()
        Get version of this artifact.
        Returns:
        artifact version, never null.
      • getPath

        java.nio.file.Path getPath()
        Get local path of artifact file or null if artifact is not resolved (doesn't have associated artifact file).
        Returns:
        artifact file path, can be null.
      • setVersion

        Artifact setVersion​(java.lang.String version)
        Set artifact version.

        Since artifacts are immutable, this method returns a new object and leaves the original unmodified.

        Parameters:
        version - the new artifact version to set
        Returns:
        copy of artifact with the new version set
      • setPath

        Artifact setPath​(java.nio.file.Path path)
        Set artifact path.

        Since artifacts are immutable, this method returns a new object and leaves the original unmodified.

        Parameters:
        path - the new artifact path to set
        Returns:
        copy of artifact with the new path set