org.codehaus.mojo.versions.api
Class ArtifactVersions

java.lang.Object
  extended by org.codehaus.mojo.versions.api.ArtifactVersions

public class ArtifactVersions
extends Object

Holds the results of a search for versions of an artifact.

Since:
1.0-alpha-3
Author:
Stephen Connolly

Constructor Summary
ArtifactVersions(Artifact artifact, ArtifactVersion[] versions, Comparator rule)
          Creates a new ArtifactVersions instance.
ArtifactVersions(Artifact artifact, List versions, Comparator rule)
          Creates a new ArtifactVersions instance.
 
Method Summary
 boolean containsVersion(String version)
           
 Artifact getArtifact()
          Returns the artifact who's version information we are holding.
 String getArtifactId()
          Returns the artifactId of the artifact who's versions we are holding.
 String getGroupId()
          Returns the groupId of the artifact who's versions we are holding.
 ArtifactVersion getLatestVersion(ArtifactVersion currentVersion, ArtifactVersion upperBound)
          Returns the latest version newer than the specified current version, but less than the specified upper bound or null if no such version exists.
 ArtifactVersion getLatestVersion(ArtifactVersion currentVersion, ArtifactVersion upperBound, boolean includeSnapshots)
          Returns the latest version newer than the specified current version, but less than the specified upper bound or null if no such version exists.
 ArtifactVersion getLatestVersion(VersionRange versionRange, boolean includeSnapshots)
          Returns the latest version within the specified version range or null if no such version exists.
 ArtifactVersion[] getNewerVersions(ArtifactVersion version)
          Returns all the available versions newer than the provided version.
 ArtifactVersion[] getNewerVersions(ArtifactVersion version, boolean includeSnapshots)
          Returns all available versions within the specified version range.
 ArtifactVersion[] getNewerVersions(String version)
          Returns all the available versions newer than the provided version.
 ArtifactVersion[] getNewerVersions(String version, boolean includeSnapshots)
          Returns all available versions within the specified version range.
 ArtifactVersion[] getVersions()
          Returns all the available versions in increasing order.
 ArtifactVersion[] getVersions(boolean includeSnapshots)
          Returns all available versions in increasing order.
 ArtifactVersion[] getVersions(VersionRange versionRange, boolean includeSnapshots)
          Returns all available versions within the specified version range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArtifactVersions

public ArtifactVersions(Artifact artifact,
                        ArtifactVersion[] versions,
                        Comparator rule)
Creates a new ArtifactVersions instance.

Parameters:
artifact - The artifact.
versions - The versions.
rule - The version comparison rule.
Since:
1.0-alpha-3

ArtifactVersions

public ArtifactVersions(Artifact artifact,
                        List versions,
                        Comparator rule)
Creates a new ArtifactVersions instance.

Parameters:
artifact - The artifact.
versions - The versions.
rule - The version comparison rule.
Since:
1.0-alpha-3
Method Detail

getArtifact

public 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 who's versions we are holding.

Returns:
the groupId.
Since:
1.0-alpha-3

getArtifactId

public String getArtifactId()
Returns the artifactId of the artifact who's versions we are holding.

Returns:
the artifactId.
Since:
1.0-alpha-3

getVersions

public ArtifactVersion[] getVersions()
Returns all the available versions in increasing order.

Returns:
all the available versions in increasing order.
Since:
1.0-alpha-3

getVersions

public ArtifactVersion[] getVersions(boolean includeSnapshots)
Returns all available versions in increasing order.

Parameters:
includeSnapshots - true if snapshots are to be included.
Returns:
all available versions in increasing order.
Since:
1.0-alpha-3

getVersions

public ArtifactVersion[] getVersions(VersionRange versionRange,
                                     boolean includeSnapshots)
Returns all available versions within the specified version range.

Parameters:
versionRange - The version range within which the version must exist.
includeSnapshots - true if snapshots are to be included.
Returns:
all available versions within the specified version range.
Since:
1.0-alpha-3

getNewerVersions

public ArtifactVersion[] getNewerVersions(ArtifactVersion version)
Returns all the available versions newer than the provided version.

Parameters:
version - The lower (exclusive) bound.
Returns:
all the available versions newer than the provided version.
Since:
1.0-alpha-3

getNewerVersions

public ArtifactVersion[] getNewerVersions(ArtifactVersion version,
                                          boolean includeSnapshots)
Returns all available versions within the specified version range.

Parameters:
version - The lower (exclusive) bound.
includeSnapshots - true if snapshots are to be included.
Returns:
all the available versions newer than the provided version.
Since:
1.0-alpha-3

getLatestVersion

public ArtifactVersion getLatestVersion(ArtifactVersion currentVersion,
                                        ArtifactVersion upperBound)
Returns the latest version newer than the specified current version, but less than the specified upper bound or null if no such version exists.

Parameters:
currentVersion - the current version.
upperBound - the exclusive upper bound.
Returns:
the latest version between currentVersion and upperBound or null if no version is available.
Since:
1.0-alpha-3

getLatestVersion

public ArtifactVersion getLatestVersion(ArtifactVersion currentVersion,
                                        ArtifactVersion upperBound,
                                        boolean includeSnapshots)
Returns the latest version newer than the specified current version, but less than the specified upper bound or null if no such version exists.

Parameters:
currentVersion - the current version.
upperBound - the exclusive upper bound.
includeSnapshots - true if snapshots are to be included.
Returns:
the latest version between currentVersion and upperBound or null if no version is available.
Since:
1.0-alpha-3

getLatestVersion

public ArtifactVersion getLatestVersion(VersionRange versionRange,
                                        boolean includeSnapshots)
Returns the latest version within the specified version range or null if no such version exists.

Parameters:
versionRange - The version range within which the version must exist.
includeSnapshots - true if snapshots are to be included.
Returns:
the latest version between currentVersion and upperBound or null if no version is available.
Since:
1.0-alpha-3

containsVersion

public boolean containsVersion(String version)

getNewerVersions

public ArtifactVersion[] getNewerVersions(String version)
Returns all the available versions newer than the provided version.

Parameters:
version - The lower (exclusive) bound.
Returns:
all the available versions newer than the provided version.
Since:
1.0-alpha-3

getNewerVersions

public ArtifactVersion[] getNewerVersions(String version,
                                          boolean includeSnapshots)
Returns all available versions within the specified version range.

Parameters:
version - The lower (exclusive) bound.
includeSnapshots - true if snapshots are to be included.
Returns:
all the available versions newer than the provided version.
Since:
1.0-alpha-3


Copyright © 2008-2009 Codehaus. All Rights Reserved.