Class ArtifactVersions

java.lang.Object
org.codehaus.mojo.versions.api.AbstractVersionDetails
org.codehaus.mojo.versions.api.ArtifactVersions
All Implemented Interfaces:
Comparable<ArtifactVersions>, VersionDetails
Direct Known Subclasses:
PluginUpdatesDetails

public class ArtifactVersions extends AbstractVersionDetails implements Comparable<ArtifactVersions>
Holds the results of a search for versions of an artifact.
Since:
1.0-alpha-3
Author:
Stephen Connolly
  • Constructor Details

    • ArtifactVersions

      public ArtifactVersions(org.apache.maven.artifact.Artifact artifact, List<org.apache.maven.artifact.versioning.ArtifactVersion> versions, VersionComparator versionComparator)
      Creates a new ArtifactVersions instance.
      Parameters:
      artifact - The artifact.
      versions - The versions.
      versionComparator - The version comparison rule.
      Since:
      1.0-alpha-3
    • ArtifactVersions

      public ArtifactVersions(ArtifactVersions other)
      Creates a new ArtifactVersions instance as shallow copy of the other
      Parameters:
      other - other object to be linked to
      Since:
      2.13.0
  • Method Details

    • compareTo

      public int compareTo(ArtifactVersions that)
      Specified by:
      compareTo in interface Comparable<ArtifactVersions>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isVersionInRange

      public static boolean isVersionInRange(org.apache.maven.artifact.versioning.ArtifactVersion version, org.apache.maven.artifact.versioning.VersionRange range)
      Checks if the version is in the range (and ensures that the range respects the -! syntax to rule out any qualifiers from range boundaries).
      Parameters:
      version - the version to check.
      range - the range to check.
      Returns:
      true if and only if the version is in the range.
      Since:
      1.3
    • getArtifact

      public org.apache.maven.artifact.Artifact getArtifact()
      Returns the artifact who's version information we are holding.
      Returns:
      the artifact who's version information we are holding.
      Since:
      1.0-alpha-3
    • getGroupId

      public String getGroupId()
      Returns the groupId of the artifact which versions we are holding.
      Returns:
      the groupId.
      Since:
      1.0-alpha-3
    • getArtifactId

      public String getArtifactId()
      Returns the artifactId of the artifact which versions we are holding.
      Returns:
      the artifactId.
      Since:
      1.0-alpha-3
    • getVersion

      public String getVersion()
      Returns the artifactId of the artifact which versions we are holding.
      Returns:
      current version
      Since:
      2.13.0
    • getVersions

      public org.apache.maven.artifact.versioning.ArtifactVersion[] getVersions(boolean includeSnapshots)
      Description copied from interface: VersionDetails
      Returns all available versions in increasing order.
      Specified by:
      getVersions in interface VersionDetails
      Parameters:
      includeSnapshots - true if snapshots are to be included.
      Returns:
      all available versions in increasing order.
    • isEmpty

      public boolean isEmpty(boolean includeSnapshots)
      Says whether the versions present in the ArtifactVersions collection are empty. If includeSnapshots is true, snapshots will not counted, which means that the method will only count release versions.
      Parameters:
      includeSnapshots - includeSnapshots is true, snapshots will not counted, which means that * the method will only count release versions.
      Returns:
      if includeSnapshots is true, returns true if there are no versions. if includeSnapshots is false, returns true if there are no releases.
    • getVersionComparator

      public VersionComparator getVersionComparator()
      Description copied from interface: VersionDetails
      Gets the rule for version comparison of this artifact.
      Specified by:
      getVersionComparator in interface VersionDetails
      Returns:
      the rule for version comparison of this artifact.
    • toString

      public String toString()
      Overrides:
      toString in class Object