org.sonatype.aether.version
Interface VersionConstraint


public interface VersionConstraint

A constraint on versions for a dependency. A constraint can either consist of one or more version ranges or a single version. In the first case, the constraint expresses a hard requirement on a version matching one of its ranges. In the second case, the constraint expresses a soft requirement on a specific version (i.e. a recommendation).

Author:
Benjamin Bentmann

Method Summary
 boolean containsVersion(Version version)
          Determines whether the specified version satisfies this constraint.
 Collection<VersionRange> getRanges()
          Gets the version ranges of this constraint.
 Version getVersion()
          Gets the version recommended by this constraint.
 

Method Detail

getRanges

Collection<VersionRange> getRanges()
Gets the version ranges of this constraint.

Returns:
The version ranges, may be empty but never null.

getVersion

Version getVersion()
Gets the version recommended by this constraint.

Returns:
The recommended version or null if none.

containsVersion

boolean containsVersion(Version version)
Determines whether the specified version satisfies this constraint. In more detail, a version satisfies this constraint if it matches at least one version range or if this constraint has no version ranges at all and the specified version equals the version recommended by the constraint.

Parameters:
version - The version to test, must not be null.
Returns:
true if the specified version satisfies this constraint, false otherwise.


Copyright © 2010-2013. All Rights Reserved.