Package org.xwiki.extension.version
Interface VersionConstraint
- All Superinterfaces:
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: c1ee6ec985d6a8d8cfb4b6ba26830e3ae25555b5 $
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsVersion
(Version version) Indicate if the providedVersion
satisfies the constraint.Gets the version ranges of this constraint.getValue()
Gets the version recommended by this constraint.boolean
isCompatible
(Version version) Indicate if the providedVersion
is compatible with this version.merge
(VersionConstraint versionConstraint) Merge two versions constraints in one.
-
Method Details
-
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
Indicate if the providedVersion
satisfies the constraint.- Parameters:
version
- the version to test, null is invalid- Returns:
- true if the provided version satisfies this constraint, false otherwise
-
isCompatible
Indicate if the providedVersion
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 whilecontainsVersion(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 two versions 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 not compatible with the provided version constraint
-