org.xwiki.extension.version
Interface VersionConstraint

All Superinterfaces:
Serializable

public interface VersionConstraint
extends Serializable

An extension version constraint. Generally on 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).

Since:
4.0M1
Version:
$Id$

Method Summary
 boolean containsVersion(Version version)
          Indicate if the provided Version satisfies the constraint.
 Collection<VersionRangeCollection> getRanges()
          Gets the version ranges of this constraint.
 String getValue()
           
 Version getVersion()
          Gets the version recommended by this constraint.
 boolean isCompatible(Version version)
          Indicate of the provided Version is compatible with this version.
 VersionConstraint merge(VersionConstraint versionConstraint)
          Merge too version constraints in one.
 

Method Detail

getRanges

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

Returns:
the version ranges, never null.

getVersion

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

Returns:
the recommended version or null if none.

getValue

String getValue()
Returns:
a String representation of the version constraint

containsVersion

boolean containsVersion(Version version)
Indicate if the provided Version satisfies the constraint.

Parameters:
version - the version to test, null is invalid
Returns:
true if the provided version satisfies this constraint, false otherwise

isCompatible

boolean isCompatible(Version version)
Indicate of the provided Version is compatible with this version.

The difference with containsVersion(Version) is that this method is trying to determine if this version should work with this constraint while containsVersion(Version) indicate if that's the ideal version for this constraint. This apply with constraint not defining an exact version range but only a recommended version constraint, in that case the constraint indicate what is the version that would ideally be required but it should work with more recent version.

Parameters:
version - the version to test, null is invalid
Returns:
true if the provided version is compatible with this constraint
Since:
4.1M2

merge

VersionConstraint merge(VersionConstraint versionConstraint)
                        throws IncompatibleVersionConstraintException
Merge too version constraints in one.

Parameters:
versionConstraint - the version constraint to merge with this version constraint
Returns:
the merged version constraint
Throws:
IncompatibleVersionConstraintException - the provided version constraint is compatible with the provided version constraint


Copyright © 2004-2012 XWiki. All Rights Reserved.